Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #3907

Re: macro conventions

Path csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date Fri, 13 May 2011 12:08:46 -0500
Message-ID <4DCD65A2.4FD0@mindspring.com> (permalink)
Date Fri, 13 May 2011 13:08:50 -0400
From pete <pfiland@mindspring.com>
Reply-To pfiland@mindspring.com
Organization PF
X-Mailer Mozilla 3.04Gold (WinNT; I)
MIME-Version 1.0
Newsgroups comp.lang.c
Subject Re: macro conventions
References <4dcd62ab$0$23874$bbae4d71@news.suddenlink.net>
Content-Type text/plain; charset=iso-8859-1
Content-Transfer-Encoding 8bit
Lines 44
X-Usenet-Provider http://www.giganews.com
NNTP-Posting-Host 4.154.219.178
X-Trace sv3-asxKqh/hS9TzC+APvRH0SRTczt8YTAlUpPTV46obICmqvO3VyCetdcenNpVWOszExOw0J9uvnMicBUa!bzWV2vo/luMyeWwTSlYAvAiraXNUlFkWm1xUFZOQEoZyma99DFkp7gn7ip/yJMgRhyhqW5ESFIvr!f+X9qbAf6w0=
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Bytes 2349
Xref x330-a1.tempe.blueboxinc.net comp.lang.c:3907

Show key headers only | View raw


Bill Cunningham wrote:
> 
>     In defining macros it is of course proper style
> to use all caps for
> example:
> 
> #define AVG 14
> 
>     There are other conventions too. In trying to learn what is the
> diference in having one underscore and two underscores
> in front of or behine a macro? For example:
> 
> #define __FILE__
> 
> Two underscores if front of and behind the define. And here:
> 
> #define _GNU_SOURCE
> 
> One underscore in front and no underscores at the end.
> I hope this is clear.
> I want to be sure of these things.

The more important thing, 
is to realise that your C implementation uses
some macro conventions which you are not supposed to use.
Macros with leading underscores are an example of that.

ISO/IEC 9899:1999 (E)

7.1.3 Reserved identifiers
    1 Each header declares or defines all identifiers listed
      in its associated subclause, 
      and optionally declares or defines identifiers listed
      in its associated future library directions subclause 
      and identifiers which are always reserved either
      for any use or for use as file scope identifiers.

     — All identifiers that begin with an underscore 
       and either an uppercase letter or another underscore 
       are always reserved for any use.


-- 
pete

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

macro conventions "Bill Cunningham" <nospam@nspam.invalid> - 2011-05-13 12:56 -0400
  Re: macro conventions pete <pfiland@mindspring.com> - 2011-05-13 13:08 -0400
  Re: macro conventions Shao Miller <sha0.miller@gmail.com> - 2011-05-13 13:14 -0400
    Re: macro conventions Keith Thompson <kst-u@mib.org> - 2011-05-13 11:41 -0700
      Re: macro conventions "Bill Cunningham" <nospam@nspam.invalid> - 2011-05-14 23:08 -0400
  Re: macro conventions ralph <nt_consulting64@yahoo.net> - 2011-05-13 13:15 -0500
    Re: macro conventions "Bill Cunningham" <nospam@nspam.invalid> - 2011-05-14 23:11 -0400
    Re: macro conventions "Bill Cunningham" <nospam@nspam.invalid> - 2011-05-15 04:00 -0400
      Re: macro conventions Angel <angel+news@spamcop.net> - 2011-05-15 11:15 +0000
        Re: macro conventions Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-05-16 04:36 +0300
          Re: macro conventions Ike Naar <ike@sverige.freeshell.org> - 2011-05-16 09:56 +0000
            Re: macro conventions Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-05-16 19:00 +0300
            Re: macro conventions Seebs <usenet-nospam@seebs.net> - 2011-05-16 19:10 +0000
              Re: macro conventions Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-05-22 21:27 +0300
    Re: macro conventions Keith Thompson <kst-u@mib.org> - 2011-05-15 06:50 -0700
      Re: macro conventions Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-05-15 08:29 -0700
        Re: macro conventions Ian Collins <ian-news@hotmail.com> - 2011-05-16 07:40 +1200
          Re: macro conventions "osmium" <r124c4u102@comcast.net> - 2011-05-15 14:52 -0500
      Re: macro conventions ralph <nt_consulting64@yahoo.net> - 2011-05-16 02:22 -0500
        Re: macro conventions Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-05-16 14:18 +0100
          Re: macro conventions David Resnick <lndresnick@gmail.com> - 2011-05-16 08:03 -0700
            Re: macro conventions Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-05-16 17:32 +0100
        Re: macro conventions Keith Thompson <kst-u@mib.org> - 2011-05-16 08:43 -0700
          Re: macro conventions Michael Press <rubrum@pacbell.net> - 2011-05-16 14:47 -0700

csiph-web