Re: [Openocd-development] Other compilers

2010-01-29 Thread Andreas Fritiofson
On Fri, Jan 29, 2010 at 7:11 PM, Michael Schwingen wrote: > Andreas Fritiofson wrote: >> This would help to avoid picking a magic value for true. >> #define false 0 >> #define true (!false) // this will actually evaluate to 1 >> > IMHO, this is unnecessary obfuscation. > The C standard guarantees

Re: [Openocd-development] Other compilers

2010-01-29 Thread David Brownell
On Friday 29 January 2010, Andreas Fritiofson wrote: > On the other hand, code that relies on specific values for true is > IMHO buggy or at least error prone (especially if "true" == -1!!), > which implies that the define shouldn't be used at all in comparisons. That was implicit in the point I m

Re: [Openocd-development] Other compilers

2010-01-29 Thread Michael Schwingen
Andreas Fritiofson wrote: > This would help to avoid picking a magic value for true. > #define false 0 > #define true (!false) // this will actually evaluate to 1 > IMHO, this is unnecessary obfuscation. The C standard guarantees that this will evaluate to 1, so why not write 1 directly? > On

Re: [Openocd-development] Other compilers

2010-01-29 Thread Andreas Fritiofson
This would help to avoid picking a magic value for true. #define false 0 #define true (!false) // this will actually evaluate to 1 On the other hand, code that relies on specific values for true is IMHO buggy or at least error prone (especially if "true" == -1!!), which implies that the define sho

Re: [Openocd-development] Other compilers

2010-01-29 Thread David Brownell
On Thursday 28 January 2010, David Brownell wrote: > If you want to know why the standard uses 1, there are > probably rationale documents circulating.  I'd guess > one of the reasons is to facilitate "bool == bit" type > implementations ... signed bits are nonsensical! Oh, and one more reason: "

Re: [Openocd-development] Other compilers

2010-01-29 Thread David Brownell
On Thursday 28 January 2010, Austin, Alex wrote: > ~/Projects $ size openocd.gcc >textdata bss dec hex filename > 915920 11600 90668 1018188 f894c openocd.gcc > ~/Projects $ size openocd.clang >textdata bss dec hex filename > 902754 10684 90572

Re: [Openocd-development] Other compilers

2010-01-28 Thread Austin, Alex
age- > From: David Brownell [mailto:davi...@pacbell.net] > Sent: Friday, January 29, 2010 1:35 AM > To: openocd-development@lists.berlios.de > Cc: Austin, Alex > Subject: Re: [Openocd-development] Other compilers > > On Thursday 28 January 2010, Austin, Alex wrote: > > +#if

Re: [Openocd-development] Other compilers

2010-01-28 Thread David Brownell
On Thursday 28 January 2010, Austin, Alex wrote: > +#ifndef true > +#define true -1 ANSI-C defines true as "1" not "-1" ... best to use that for compatibility. I suspect I'll merge this portability patch with that change... > +#define false 0 > +#endif By the way, were those object sizes "size

[Openocd-development] Other compilers

2010-01-28 Thread Austin, Alex
So, just for curiosity, I decided to try llvm-clang to build openocd. I haven't actually run the build yet, but it's just over half the size of the gcc build, and compiled just a touch faster, too. Any comments? The time output is from "make -j3" calls. openocd-via-gcc: real0m25.669s user0