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


Groups > comp.lang.c > #109254

Re: Tiny question

From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.c
Subject Re: Tiny question
Date 2017-05-04 20:37 +0100
Organization A noiseless patient Spider
Message-ID <8737cke7ld.fsf@bsb.me.uk> (permalink)
References <ef527002-1fb3-45f8-9939-2df47e1cd976@googlegroups.com>

Show all headers | View raw


David Kleinecke <dkleinecke@gmail.com> writes:

> Would there be any downside were I to realize character
> constants in the preprocessor rather than in the parser?
> That is, for example, the pre-processor changes the three
> characters 'a' to 0x61. and so on for other characters 
> including the wise ones.

(assuming s/wise/wide/)

For 'plain' characters it would depend on when in the PP the conversion
happens.  For example

  #define s(x) #x
  s('a')

must generate "'a'" so you can't change 'a' to 0x61 when reading tokens.

For the wide characters you are likely to have more trouble.  L'a' is an
expression of type wchar_t and u'a' and U'a' are of type char16_t and
char32_t.

-- 
Ben.

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


Thread

Tiny question David Kleinecke <dkleinecke@gmail.com> - 2017-05-03 20:45 -0700
  Re: Tiny question Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-05-04 20:37 +0100
    Re: Tiny question David Kleinecke <dkleinecke@gmail.com> - 2017-05-04 19:45 -0700
  Re: Tiny question Barry Schwarz <schwarzb@dqel.com> - 2017-05-04 23:14 -0700
    Re: Tiny question mark.bluemel@gmail.com - 2017-05-05 01:08 -0700
    Re: Tiny question David Kleinecke <dkleinecke@gmail.com> - 2017-05-05 12:36 -0700

csiph-web