News for hackers. Stuff that matters.
Re:Cello High Level C: A Fat Pointer Library by nocsaer1 on Sunday November 08, 2015 @05:06PM (#10530193)
Don't get me started...

It is called a struct. It holds arbitrary collection of any type of data safely while enabling the lazy programmer to pass only one parameter around. It is also safe (as must as it can be in C) unlike pointers that hide data behind their back and are just asking for trouble.

I will ignore all the problems and point out the worst offender, stack allocation example. That is not how you allocate arbitrary data on the stack, automatic char array is not malloc. In fact, in C you can't do it without using special platform specific functions. Anything else will cause undefined behavior.

Re:Cello High Level C: A Fat Pointer Library by mistercow on Sunday November 08, 2015 @07:39PM (#10530791)
I think the reason for this is that they're trying to manipulate C's syntax to get a certain kind of intuitive style. They seem to want it to be concise and C-like (without resorting to macros), but they want to add their own functionality without actually extending the language. In this case, they want you to just be able to cast a Cello "var" pointer to a specific type pointer using the normal cast syntax.

I'm not saying it's the right choice. Just that I understand why they did it that way.

Still, I think a macro would be a perfectly reasonable way to do it.

Re:Cello High Level C: A Fat Pointer Library by ploxiln on Sunday November 08, 2015 @06:37PM (#10530542)
Variable length arrays on the stack are in the C99 standard.

(If you're using Microsoft stuff, you have my condolences.)

Re:Cello High Level C: A Fat Pointer Library by nocsaer1 on Sunday November 08, 2015 @07:00PM (#10530641)
My argument doesn't rely on their (non) availability.