Re: [PATCH] Avoid C++ comments, use C comments instead

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 7/11/06, Johannes Schindelin <Johannes.Schindelin@xxxxxx> wrote:
Hi,

On Mon, 10 Jul 2006, Olivier Galibert wrote:

> On Mon, Jul 10, 2006 at 02:14:17PM -0500, Paul Serice wrote:
> > If you want to write portable code, you have to take into account
> > different operating systems _and_ different compilers.  Writing your
> > code for just a single compiler is almost as bad as writing your code
> > for just a single operating system.
>
> Hmmm, that was not so much about gcc-specific code than which kind of
> C you want to code to, the one from 1973, the one from 1989 or the one
> from 1999?  I personally don't have much sympathy for the OS vendors
> giving you an older standard C compiler and selling you the up-to-date
> one.

Judging by what you say, one could get the impression you'd have not much
sympathy for people being stuck with non-C99 compilers.

Just look at it: if the OS vendor just does not _care_, and you blame the
vendor for not providing something newer, the vendor does not _care_ about
your complaint either. But the user does.

However, there is a more important point to be made. If you are complying
with an older standard, you get more users. More users = more bug testers.

And there were quite a few occasions where I found bugs by trying to run
on a different platform, which was less forgiving than Linux. These are
bugs you have a harder time to spot on Linux, _because_ Linux is so nice.
But they will surface. And they will be a PITA to find.

Anyway, it is best practice for a reason to program portably. (Well, at
least if you are not living in Redmont.)

Back in the beginning of nineties, c89 was new and the
prototypes was not yet impemented on many compilers.
One good trick of the time was automatic
source conversion. This protoize/unprotoize tool converted
sources from non-prototyped form to
prototyped, and the other way. (There was also #ifdef-trick
which was ugly as hell for the same purpose, and the __P()
macro trick, which was less ugly).

The benefit was that you got the benefit of both worlds,
(1) the benefit of prototypes when compiler was c89-compliant, and
(2) compilability with pre-c89 compilers when needed.

I am writing in order to ask, whether there maybe
some c99-to-c89 source convertor that can be
automatically applied to the .c before compiling with
pre-c99 compiler ?

Yakov
-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]