pouët.net

Go to bottom

do you const OR const do you

category: general [glöplog]
Quote:
Code:int*(*const*T[])(int*,struct T{void*const y;}*volatile*const volatile[]);


Okay, it's late, and I think I just blew my mind, but here's my stab at it:

T is an array of implicit length 1 of constant pointers to functions which return a pointer to an integer and take the parameters: pointer to int, volatile pointer to volatile pointer to constant pointer of a structure comprised of a constant pointer to void called y. :)
added on the 2007-12-11 02:08:19 by leblane leblane
it's pretty close, but no cigar :)
added on the 2007-12-11 02:20:03 by ryg ryg
sod it!!!!

a 1 length array of constant pointer to pointer of functions each returning an int* with parameters:
int* and a volatile pointer to a volatile pointer to a constant array of structure T which contains a const void pointer y

this thing is killing me
added on the 2007-12-11 02:31:01 by xwize xwize
BB Image
added on the 2007-12-11 02:45:05 by xwize xwize
xwize, nope :)
added on the 2007-12-11 02:50:55 by ryg ryg
BB Image
added on the 2007-12-11 03:38:27 by xwize xwize
Everyone knows real men use assembly language...

Seriously, though, what ps said. The only places where const is trouble-free are as a replacement for #define and as a note-to-self not to update state in certain member functions like Render(). Anything else is a waste of time. In those cases, does it really matter where const goes?
added on the 2007-12-11 06:00:06 by s_tec s_tec
ryg then again, I'd shoot any coworker attempting to write such a type!

Especially since there's no way in C to use the type system as an automata of its own :]
added on the 2007-12-11 06:54:08 by _-_-__ _-_-__
It is a wormhole leading to another dimension where insane compilers rule the earth. I'd shoot him. srsly.

But there's nothing like the good old
Code:(const char *)(this+7)
anyway
added on the 2007-12-11 12:04:07 by raer raer
Quote:
Seriously, though, what ps said. The only places where const is trouble-free are as a replacement for #define and as a note-to-self not to update state in certain member functions like Render(). Anything else is a waste of time. In those cases, does it really matter where const goes?


It does if you're writing code which other people will use.
rarefluid, do you really mean "(const char *)(this+7)", or is it "((const char *) this + 7)" instead? :)
added on the 2007-12-11 16:12:26 by ryg ryg
Quote:
It does if you're writing code which other people will use.


... or when simply passing parameters by reference. Many modern compilers don't like non-const refs to temporaries very much.
added on the 2007-12-11 16:23:10 by kb_ kb_
haha, xwize, go :)

seriously, though, maybe I can try to elighten you ryg: you don't necessarily need such a low-level horrible-syntax dark-cornerstones language even if you deliberately want to write such obfuscated code :)

(and no, before you ask, I'm not thinking of perl or even apl...)
added on the 2007-12-11 16:32:10 by blala blala
that makes me wonder, has a demo already been made or partially made with a homemade language, or has a compiler design freak already made his own compiler only to build some special demo effects (AI or else...) ? :D
added on the 2007-12-11 16:36:35 by Zest Zest
Zest: yes.
added on the 2007-12-11 16:53:02 by gasman gasman
this is ART :)
added on the 2007-12-11 17:23:48 by Zest Zest
Zest: I remember some hungarian guy having his own homegrown pascal/c/assembly (or pascal/basic/assembly?) mixture or something like that (back in the mid-90s), and coding intros in that...

I don't think however that it's meaningful to build a compiler "to build some special demo effects (AI or else...)". I mean, a new language won't enable you making new effects, just (possibly) make them easier.
added on the 2007-12-11 17:34:37 by blala blala
yup, actually i was thinking of Lisp for AI people, but lisp is already history, i have no idea what state-of-the-art AI people use nowadays, except that i know that AI engineers in game development usually use interpreted script languages like unrealscript, quakeC or open-source LUA...

building one's own compiler or virtual machine is like reinventing the wheel but demo is all about its masterwork not its purpose, right ? ;)

unless obfuscation is sought, as a custom vm is a good protection against curious crackers :)
added on the 2007-12-11 17:56:16 by Zest Zest
AI today is very different from what it used to be. Pure symbolic AI (where Lisp could have some advantages) seems to be a dead end. So Lisp has no particular advantages in the AI field today, I think (apart from being a somewhat high-level language).

(I didn't mean it's useless to write a compiler - it should be a very good learning experience - but that it's useless to write a compiler for the sake of building new effects)
added on the 2007-12-11 18:29:56 by blala blala
ryg. suit yourself, but you could never beat my coworkers at writing crappy code that leaks and breaks like an old bucket. My current job (const)antly gives me new insights "how to absolutely NOT do it"... :(
But on the other side they're pretty creative in crapping the codebase up ;)
added on the 2007-12-11 19:47:17 by raer raer
zest, you could sortof count plenty horrible scripting languages that the world's demosystems spawned. though i guess few were turing complete of sorts.
added on the 2007-12-11 20:17:54 by skrebbel skrebbel
ah yeah if a demosystem timeline script need real custom parsing, it's already a step towards compiling art, but not yet a full language/interpreter/compiler. So there have been or are demo scripting systems that aim at emulating a complete turing system ?
added on the 2007-12-11 21:24:27 by Zest Zest
aren't loonies 4k intros made with some sort of bytecodes?
added on the 2007-12-11 21:27:02 by _-_-__ _-_-__
Quote:
aren't loonies 4k intros made with some sort of bytecodes?

Well, atleast TBL uses the WinUAE VM.
added on the 2007-12-11 23:00:59 by Hatikvah Hatikvah
stefan aren't intel cpu(s) nowadays anyway just pretending to be x86?
added on the 2007-12-11 23:04:51 by _-_-__ _-_-__

login

Go to top