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


Groups > comp.lang.c > #3907

Re: macro conventions

Message-ID <4DCD65A2.4FD0@mindspring.com> (permalink)
Date 2011-05-13 13:08 -0400
From pete <pfiland@mindspring.com>
Organization PF
Newsgroups comp.lang.c
Subject Re: macro conventions
References <4dcd62ab$0$23874$bbae4d71@news.suddenlink.net>

Show all headers | 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