I beg to differ on this one since, in my experience, the one thing ANSI C
is not, is 'portable'.
After 15 years of writing C on almost every platform known to man (and some
which aren't...) I can almost guarantee that code which strictly adheres to
K&R rules will compile cleanly on any platform (given a few system call
differences, like vfork() etc).
However, I have yet to find two ANSI C compilers which agree on all points
of the so-called standard. You'll find they cautiously refer to 'levels of
compliance'.
I remember 'translating' to ANSI some quite ordinary X11/Motif K&R code
which ran very nicely on AIX, SGI and Sun. It finished up being peppered
with hundreds of '#ifdef AIX' '#ifdef SGI' statements, and inherited some
interesting bugs.
If you only support one compiler, like gcc, then you might be able to port
the same code to most platforms. However, first read the platform specific
notes that come with gcc - it doesn't *quite* work the same on every
box....
Best regards,
Mark
------------------------------------------------------------------------
Mark Sitkowski
Design Simulation Systems Ltd
14 Loddon Street
Box Hill North, Victoria 3129
------------------------------------------------------------------------
phone: (613-9) 897-1375 fax: (613-9) 897-1376
Mobile: 0413-890-777 E-mail: marks@iaccess.com.au
Web: www.angelfire.com/de/designsim
www.asiafind.com/sites/designsim
------------------------------------------------------------------------
There has been discussion recently about adding/removing compiler warnings.
If you want to write good clean code that is portable, then use ANSI C
compiler (not allowing tradtional C), and remove all warnings. The
following
flags should be used.
-ansi -pedantic -Wall
Adding the flag "-Wpointer-arith", is probably a good idea, or at least
a very good reason why the warnings are OK.
As the ansi and pedantic flags are not currently used, they should be
introduced for the next release, after the release on Sunday.
Harry
In message <38AE7D8F.9A0334B8@dial.pipex.com>, John Vickers writes:
<snip>
>> Therefore I suggest to remove the flag -Wpointer-arith from the final
>> release.
>
>Or maybe remove all the warning flags, even. I get huge numbers of
>warnings
>building Sane with "-W -Wall". But for development releases,
>we should really be trying to get rid of the causes of the warnings.
>
-- Source code, list archive, and docs: http://www.mostang.com/sane/ To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com-- Source code, list archive, and docs: http://www.mostang.com/sane/ To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com
This archive was generated by hypermail 2b29 : Sun Feb 20 2000 - 15:53:44 PST