[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-ha-dev
Subject:    Re: [Linux-ha-dev] portability
From:       "Sebastian Reitenbach" <sebastia () l00-bugdead-prods ! de>
Date:       2008-03-14 6:47:16
Message-ID: 20080314064716.ED0E58394F () smtp ! l00-bugdead-prods ! de
[Download RAW message or body]

Hi,
High-Availability Linux Development List <linux-ha-dev@lists.linux-ha.org> 
wrote: 
> On Tue, 4 Mar 2008, Lars Marowsky-Bree wrote:
> 
> > [...]
> > http://hg.linux-ha.org/dev/rev/b71a9500faa3
> >
> > greatly reduces readability. The [0] array trick is a very common
> > approach, and I know of no compiler which cannot handle this.
> > [...]
> > Portability is alright, but there comes a point where modern language
> > features such as ISO C99 really help. It's 2008, afterall ;-)
> 
> Agreed.  Let's use (reasonably) modern language features attempt to revert
> (with one adjustment: see below) my earlier edit.
> 
> And certainly the original code looks clearer than my changed code; so
> the original is, in principle, more maintainable (and mine worse!).
> 
> But you mention both "the [0] array trick" and "ISO C99" as if they are
> related.  But they are not.  While C99 supports the _idea_ behind "the
> '[0]' trick" its name for this is "flexible array member", and its syntax
> simply "[]".
> 
> The proper C99 way seems to be '[]', and 'gcc' supports this. (The "'[0]'
> trick" seems to be a GNU extension, since superseded by C99 '[]').
> 
> Can we pursue the C99 '[]' route?  It works on 'gcc' on a variety of Linux
> (32-bit and 64-bit) around here (and Solaris: both gcc and Sun).
> 
> That means we can (in principle, although not quite exactly) undo my
> previous edit.  (And I agree, the original code does look clearer!)
> 
> Can I request that we migrate from GNU-extension '[0]' to C99 '[]'?
> 
> (Alternatively we could migrate to '[ZEROSIZE]', with configure
> determining whether to #define 'ZEROSIZE' to '0' or empty; but that looks
> a bit hacky.)
> 
> Further, if we are happy with "C99" as our programming standard, then we
> can consider also use the "-std=c99" flag to 'gcc'.
> 
> Is that route/idea OK with you, Lars?

right now, heartbeat compiles and runs on OpenBSD sparc too. The compiler 
that ships with OpenBSD on that architecture is gcc 2.95. Afaik, the c99 
standard is poorly supported with this compiler version, if at all.
The sparc architecture is the only architecture I have here at hand, that 
comes with gcc 2.95, but there are more, where OpenBSD ships this compiler 
version. 
Well, most of the architectures that OpenBSD supports come with a gcc-3.3.5 
or there a like, or on sparc architecture, a gcc 3.3.X can be installed via 
ports system, but usually, it is preferred to take the compiler from the 
base system. 
I just wanted to point this out, but I know, its an old and slow 
architecture, and its just the question whether it makes sense to care about 
it at all.

kind regards
Sebastian

_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic