#define if!(x) if(!(x))

Sage
Posts: 1,403
Joined: 2005.07
Post: #1
#define if!(x) if(!(x)) isnt allowed, I get this warning warning: "ISO C requires whitespace after the macro name"
Does anyone know why?

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #2
I'd wager a guess that the macro name can't contain !, since that a unary operator, not a character.
Quote this message in a reply
Sage
Posts: 1,403
Joined: 2005.07
Post: #3
But why cant I use a unary operator in a define?

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #4
You can, but not in the name. You're trying to define a macro named "if!". Smile
Quote this message in a reply
Sage
Posts: 1,403
Joined: 2005.07
Post: #5
I know, and im not allowed to Cry

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
DoG
Moderator
Posts: 869
Joined: 2003.01
Post: #6
unknown Wrote:#define if!(x) if(!(x)) isnt allowed, I get this warning warning: "ISO C requires whitespace after the macro name"
Does anyone know why?

Why?! Because it's stupid! Rasp

Hands off operator look-alike macro definitions! You could try #define IFNOT or something similar, though i really dont see any gain. At most you save yourself from having to type a pair of parenthesis at the expensive of horribly unreadable code.
Quote this message in a reply
Moderator
Posts: 522
Joined: 2002.04
Post: #7
unknown Wrote:#define if!(x) if(!(x)) isnt allowed, I get this warning warning: "ISO C requires whitespace after the macro name"
Does anyone know why?

You should be a lisp user...
Quote this message in a reply
Sage
Posts: 1,403
Joined: 2005.07
Post: #8
if!(x) if(!(x)) saves a set of brackets...
im just doing fi instead because its if written backwards, clever see!

*goes off to check out lisp
*shudders at the number of brackets he see's

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
Moderator
Posts: 522
Joined: 2002.04
Post: #9
unknown Wrote:if!(x) if(!(x)) saves a set of brackets...
im just doing fi instead because its if written backwards, clever see!

*goes off to check out lisp
*shudders at the number of brackets he see's

Those are parentheses, not brackets, and they are beautiful.

-Jon
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #10
Code:
#define ifn(x) if (!(x))

is just as few characters. I still think you're nuts though Smile
Quote this message in a reply
Sage
Posts: 1,403
Joined: 2005.07
Post: #11
I am Wow Wacko Mad .
this works nicely too:
#define while_dont(x) while(!(x))

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
DoG
Moderator
Posts: 869
Joined: 2003.01
Post: #12
unknown Wrote:I am Wow Wacko Mad .
this works nicely too:
#define while_dont(x) while(!(x))

Make sure you never show that to anyone of authority, they might have you locked up and/or dumped into the gutter for that.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #13
"while_not" is more usually called "until" in english Rasp
Quote this message in a reply
Sage
Posts: 1,403
Joined: 2005.07
Post: #14
oh yeah!
That totally slipped my mind.

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
Moderator
Posts: 771
Joined: 2003.04
Post: #15
unknown Wrote:if!(x) if(!(x)) saves a set of brackets...
im just doing fi instead because its if written backwards, clever see!

Remember that thread about comments? Add one after every "fi (...)" Wink
Quote this message in a reply
Post Reply