Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Official C Challenge ①

Name: Anonymous 2010-07-18 12:23

Task:  Come up with an extension to the C programming language.  Provide a clear description of the extension, and a code sample that clearly shows what the extension is intended to do.

Prize:  (Winning criteria are not specified.)  The winner will have his extension featured in the C11 language standard.

My entry:  ... Sorry, I think C is perfect in every way already.

Name: Anonymous 2010-07-19 10:09

>>52

listen if you need to know the size of a buffer you do it like this


struct buffer {
    size_t size;
    unsigned char *ptr;
};


if you need to know the size of a struct you do this


sizeof(struct sumthin);


if you want to allocate an array it's easy


struct whatever *p = malloc(sizeof(*p) * n);


what exactly are you having problems with... don't know what foreign/future/closed code has to do with anything because if it's closed then you don't NEED to know how much memory something uses because it's not like you can go poking around inside

as for your sentence structure I have a hard time parsing that first sentence it's not like I'm exactly the model of eloquence but I'm just not sure what problem you're having with your programs that you need to figure out the size of an opaque region of memory... besides, you can write your own malloc and add this feature it's not that hard but it will only let you query the size of heap objects not stack objects, obviously

and the ad hominem attacks are a bit puerile, even for these backwaters of the internet... I don't know what code you write so don't go telling me I don't write portable or scalable code for all you know I'm a respectable programmer who just likes to go trolling from time to time hey it could happen

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List