TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Roy McNeill
from: Paul Edwards
date: 1996-03-08 00:59:46
subject: # and _

RM> I recently wrote a teensy program to play a small tune, and used
RM> the line

RM> #define  C#  271

RM> to define the integer frequency of C Sharp. The compiler (BC++4)
RM> objected to the # in C#. I thought the preprocessor was a true
RM> macro processor, and could handle abominations like that. Why was I
RM> wrong?

In
#define xxx yyy
the xxx is an identifier.  An identifier is defined as a sequence 
of alpha + _ + digits, starting with a non-digit.  FREQ ANSI_C.*
from 3:711/934 for more info.

RM> _:

RM> I've always been puzzled by the use of the leading underscore in C
RM> programs. It's a standard character like a,b,c as far as the
RM> compiler is concerned, but it appears at the front of some
                                                          ^^^^
RM> constants and functions as if it has some magical significance.
    ^^^^^^^^^^^^^^^^^^^^^^^
RM> What is this significance?

There are no special constants or functions that start with _ that
I am aware of in the C standard.

However, identifiers starting with _ followed by a capital letter,
OR two __, are RESERVED for internal use by the C compiler.  FREQ
PDPCLIB from 3:711/934 for an implementation of a C compiler that
makes use of this reserved feature.  BFN.  Paul.
@EOT:

---
* Origin: X (3:711/934.9)

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.