Printing "hello , wolrd" with out using semicolon

  • Thread starter Prashanth Badabagni
  • Start date
P

Peter Nilsson

Arthur J. O'Dwyer said:
#define P(x) printf(#x
#define L(x) #x
#define S L(| |)[!Z]
int f(int l,int i){if((i=l,!Z)&&l==Z&&P(%c%c%d\n),S,S,Z)&&f
(++i,i)){}else if(--l==Z&&P(\n))&&f(++i,i)){}else if(--l==Z

The \ in \n is not at the end of a line, not part of a character or
string literal, not part of a universal character, not part of an
include header, and does not constitute a punctuator or other
preprocessor token.

Macro processing, including # stringising macros, is done in translation
phase 4; escape sequences are translated in phase 5.

But conversion to preprocessing tokens occurs in phase 3, by which
time an isolated backslash character like the one above is _not_ a
preprocessor token.
 
M

Martin Dickopp

#define P(x) printf(#x
#define L(x) #x
#define S L(| |)[!Z]
int f(int l,int i){if((i=l,!Z)&&l==Z&&P(%c%c%d\n),S,S,Z)&&f
(++i,i)){}else if(--l==Z&&P(\n))&&f(++i,i)){}else if(--l==Z

The \ in \n is not at the end of a line, not part of a character or
string literal, not part of a universal character, not part of an
include header, and does not constitute a punctuator or other
preprocessor token.

Macro processing, including # stringising macros, is done in translation
phase 4; escape sequences are translated in phase 5.

But conversion to preprocessing tokens occurs in phase 3, by which
time an isolated backslash character like the one above is _not_ a
preprocessor token.

Why not? 6.4#3:

| [...] A preprocessing token is the minimal lexical element of the
| language in translation phases 3 through 6. The categories of
| preprocessing tokens are: header names, identifiers, preprocessing
| numbers, character constants, string literals, punctuators, and single
| non-white-space characters that do not lexically match the other
| preprocessing token categories. [...]

A single backslash character seems to fit into the last category.

Martin
 
P

Peter Nilsson

Martin Dickopp said:
(e-mail address removed) (Peter Nilsson) wrote:

#define P(x) printf(#x
#define L(x) #x
#define S L(| |)[!Z]
int f(int l,int i){if((i=l,!Z)&&l==Z&&P(%c%c%d\n),S,S,Z)&&f
(++i,i)){}else if(--l==Z&&P(\n))&&f(++i,i)){}else if(--l==Z

The \ in \n is not at the end of a line, not part of a character or
string literal, not part of a universal character, not part of an
include header, and does not constitute a punctuator or other
preprocessor token.

Macro processing, including # stringising macros, is done in translation
phase 4; escape sequences are translated in phase 5.

But conversion to preprocessing tokens occurs in phase 3, by which
time an isolated backslash character like the one above is _not_ a
preprocessor token.

Why not? 6.4#3:

| [...] A preprocessing token is the minimal lexical element of the
| language in translation phases 3 through 6. The categories of
| preprocessing tokens are: header names, identifiers, preprocessing
| numbers, character constants, string literals, punctuators, and single
| non-white-space characters that do not lexically match the other
| preprocessing token categories. [...]

A single backslash character seems to fit into the last category.

Yup, my (very) bad.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Hello everyone 0
Hello everyone ! 4
Hello Everybody 0
Hello I'm new to coding 1
bugs in c 20
Hello there ! 2
Any Ideas On This Simple Co-Prime program 1
Hello there 3

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,149
Latest member
Vinay Kumar Nevatia0
Top