On Thu, Apr 30, 2009 at 4:59 AM, Igor Skochinsky <skochin...@mail.ru> wrote: > Hello Dick, > > Thursday, April 30, 2009, 4:28:54 AM, you wrote: > > >>> Due to the lack of prior opposition, I had been debating whether to >>> simply commit a change that adds -std=c99 and seeing how the community >>> reacts (since I can now revert it quickly if it poses a real problem). >>> > DH> The -std=c99 option is a big positive for me. I like it. There are C > DH> compilers and there are C++ compilers. In the C compiler realm, it is > DH> difficult to surpass GNU GCC and mingw and cygwin hosted forms. So I > DH> have lost all enthusiasm for trying to support another C compiler, > DH> because it means dumbing down the code. > > DH> In the realm of C++ compilers, there is probably less reason to take > DH> this stance, since C++ compilers are all pretty capable, and you would > DH> not have to dumb down the code. > > DH> So this command line option is a very good idea in my opinion. We are > DH> already programming on our hands and knees by choosing to use C. At > DH> least this gives us knee pads. Someday maybe we'll actually get up and > DH> program on our feet. > > So far the only C99 features I encountered were: > > 1) variables declared in the middle of a block > 2) designated initializers (.field = value in structures) > 3) variadic macros > > 3 is supported by MSVC. 1 can be convenient, but is not used that > much in the source so far - most variables are still declared at the > start of the block. 2 makes some structure definitions more > compact, but really, is it that much harder to write > /* name */ "cfi", > /* register_commands */ cfi_register_commands, > /* flash_bank_command */ cfi_flash_bank_command, > than > .name = "cfi", > .register_commands = cfi_register_commands, > .flash_bank_command = cfi_flash_bank_command, > ? > > What are the _real_ benefits, not conveniences, that that switch can > bring?
The designated initializers allow you to add a new field without having to add it to all implementations of that interface. They also avoid some potential bugs where the order of identically typed entries changes. All of that is of course also achievable with C++ virtual functions. Michael _______________________________________________ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development