designated structure initialization not allowed in c++?

This is a discussion on designated structure initialization not allowed in c++? within the C++ Programming forums, part of the General Programming Boards category; e.g.: Code: struct foo { int a, b, c; }; struct foo f = { .b = 1024, .c = ...

  1. #1
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Posts
    5,439

    Question designated structure initialization not allowed in c++?

    e.g.:

    Code:
    struct foo { int a, b, c; };
    struct foo f = { .b = 1024, .c = 4096 };
    


    ...or was this just a gcc extension for c? I've looked through the options listing but didn't find an obvious switch for this - perhaps there's an undocumented one?
    Last edited by Sebastiani; 09-15-2007 at 07:45 AM. Reason: syntax
    Code:
    int main(void){srand(time(0));for(double l=rand(),l0=0,l00=0;;l0+=0.1){for(double l000=0;l000
    <1;l000+=.001,l+=((double)rand()/RAND_MAX)/0x64,l00+=((sin(l*0x8*atan(l0)*l000-(l0*0x8*atan
    (l)))*0.5)+0.5)){l00-=floor(l00);for(size_t l0000=0,l00000=(size_t)(0x50*(l00));l0000<l00000;++l0000
    )putchar(0x20);putchar(0x61+(int)((double)rand()/RAND_MAX*0x1a));putchar('\n');}}return 0;}

  2. #2
    and the hat of mystery Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    31,340
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Posts
    5,439
    ah, I see. thank you.
    Code:
    int main(void){srand(time(0));for(double l=rand(),l0=0,l00=0;;l0+=0.1){for(double l000=0;l000
    <1;l000+=.001,l+=((double)rand()/RAND_MAX)/0x64,l00+=((sin(l*0x8*atan(l0)*l000-(l0*0x8*atan
    (l)))*0.5)+0.5)){l00-=floor(l00);for(size_t l0000=0,l00000=(size_t)(0x50*(l00));l0000<l00000;++l0000
    )putchar(0x20);putchar(0x61+(int)((double)rand()/RAND_MAX*0x1a));putchar('\n');}}return 0;}

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 04:45 PM
  2. Replies: 9
    Last Post: 10-26-2005, 07:29 AM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  4. Serial Communications in C
    By ExDigit in forum Windows Programming
    Replies: 7
    Last Post: 01-09-2002, 09:52 AM
  5. structure member initialization
    By ivandn in forum C Programming
    Replies: 4
    Last Post: 10-27-2001, 01:27 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21