This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: A comment-finding hack for hppa I found useful
- To: Nick Clifton <nickc at cygnus dot com>
- Subject: Re: A comment-finding hack for hppa I found useful
- From: Michael Meissner <meissner at cygnus dot com>
- Date: Wed, 12 Jul 2000 18:37:05 -0400
- Cc: binutils at sourceware dot cygnus dot com
- References: <200007111910.MAA17553@elmo.cygnus.com>
On Tue, Jul 11, 2000 at 12:10:52PM -0700, Nick Clifton wrote:
> Hi Alan,
>
> : I found the following hack useful when debugging glibc sources
> : for hppa. The comment in the first hunk below indicates why it's
> : useful, but I'm ambivalent as to whether this belongs in the
> : official sources.
>
> So basically the problem is that (for the hppa) the comment chracater,
> (';') is the same as the line seperator character for lots of other
> assemblers, and that tihs leads to confusion, especially when writing
> C asm statements ?
>
> I guess I have no objections to adding the feature, although I think
> that it will only very occaisionally be useful. perhaps it could be
> part of the output with the -D switch ?
>
> : PS. Question for the language experts. "#if MACRO" or "#ifdef MACRO",
> : which is preferred? Given MACRO is either undefined or evaluates to 1,
> : there is no difference really (except I believe some really old compilers
> : don't even supprt #ifdef)
At the time of the original C standard was being produced (1984 or 1985 being
the first meeting), there were no known compilers still in use that did not
support #ifdef (K&R-1 mentions both #ifdef and #if). I do recall having
#ifdef's and a preprocessor when I was working on a UNIX V6 system in 1979
(though you had to make sure the first byte of the file was '#' or else the
preprocessor was not run, and it had the original wacky structure rules). The
default compiler on SunOS does support #if name and #if defined(name).
> I had not heard about old compilers not supporting #ifdef, but I think
> from a very strict point of view, I would prefer '#ifdef MACRO" over
> "#if MACRO" since this makes clear that all that is being tested is
> the fact that MACRO is defined, not what value it might happen to
> have.
I agree with Nick.
--
Michael Meissner, Red Hat, Inc.
PMB 198, 174 Littleton Road #3, Westford, Massachusetts 01886, USA
Work: meissner@redhat.com phone: +1 978-486-9304
Non-work: meissner@spectacle-pond.org fax: +1 978-692-4482