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


Groups > comp.lang.c > #149846

Re: what does # mean?

From T <T@invalid.invalid>
Newsgroups comp.lang.c
Subject Re: what does # mean?
Date 2020-02-08 00:10 -0800
Organization A noiseless patient Spider
Message-ID <r1lqec$71e$1@dont-email.me> (permalink)
References <r1l2nb$n2s$1@dont-email.me> <6dcd71aa-6b41-4193-8d53-813dbc198686@googlegroups.com>

Show all headers | View raw


On 2020-02-07 20:04, James Kuyper wrote:
> On Friday, February 7, 2020 at 8:26:13 PM UTC-5, T wrote:
>> Hi All
>>
>> what does the "#" in
>>
>>        #define GDK_SELECTION_SECONDARY  GDK_MAKE_ATOM (2)
>>
>> mean?
>>
>> And is "define" what others call a constant?
> 
> The # does not mean anything on it's own, but every preprocessing
> directive starts with #. #define is one kind of preprocessing directive.
> It defines a macro, in this case GDK_SELECTION_SECONDARY. Associated
> with a macro is its replacement text, in this case  "GDK_MAKE_ATOM (2)".
> After a macro is defined, subsequent occurrences of the macro get
> replaced with the replacement text for that macro. Therefore, if you had
> a line like
> 
>    int n = GDK_SELECTION_SECONDARY;
> 
> Then after replacement, it would say:
> 
>    int n = GDK_MAKE_ATOM (2);
> 
> There are some moderately complicated rules governing special cases with
> macros, but at your level the only important thing you need to know is
> that the macro gets replaced by its replacement text. The expansion of a
> macro can be a constant, but this is not an example. The following is an
> example:
> 
>    #define MONTHS_PER_YEAR 12
> 


Thank you!

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


Thread

what does # mean? T <T@invalid.invalid> - 2020-02-07 17:26 -0800
  Re: what does # mean? luser droog <luser.droog@gmail.com> - 2020-02-07 17:51 -0800
    Re: what does # mean? T <T@invalid.invalid> - 2020-02-07 18:00 -0800
  Re: what does # mean? T <T@invalid.invalid> - 2020-02-07 18:00 -0800
  Re: what does # mean? James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-02-07 20:04 -0800
    Re: what does # mean? T <T@invalid.invalid> - 2020-02-08 00:10 -0800
    Re: what does # mean? scott@slp53.sl.home (Scott Lurndal) - 2020-02-08 18:35 +0000
      Re: what does # mean? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-02-08 13:38 -0800

csiph-web