Source: http://gcc.gnu.org/onlinedocs/cpp/Macros.html

You may define any valid identifier as a macro, even if it is a C
keyword. The preprocessor does not know anything about keywords. This
can be useful if you wish to hide a keyword such as const from an
older compiler that does not understand it. However, the preprocessor
operator defined (see Defined) can never be defined as a macro, and
C++'s named operators (see C++ Named Operators) cannot be macros when
you are compiling C++.


Cheers,
-Bala

“Judge nothing, be happy.
 Forgive everything, be happier.
 Love everything, be happiest.”
~Sri Chinmoy


On Wed, Sep 5, 2012 at 8:12 AM, Shashank Jain <[email protected]> wrote:
> can you plz explain how it happens ...as valid macro names  must not be key
> words.
>
>
> On Wed, Sep 5, 2012 at 6:24 PM, Shashank Jain <[email protected]>
> wrote:
>>
>>
>> it works
>> thanks for your reply
>>
>>
>>
>> On Wed, Sep 5, 2012 at 6:19 PM, Bala <[email protected]> wrote:
>>>
>>> #define while(x) while(1)
>>>
>>> Cheers,
>>> -Bala
>>>
>>>
>>>
>>> On Wed, Sep 5, 2012 at 7:45 AM, Shashank Jain <[email protected]>
>>> wrote:
>>> > Here is a question...and i am badly stuck at it
>>> >
>>> > how would you get into the loop
>>> >
>>> > int main()
>>> > {
>>> >
>>> >      while ( 0)
>>> >      {
>>> >            printf("hello");
>>> >
>>> >      }
>>> > return 0;
>>> > }
>>> >
>>> >
>>> > You cannot change the while loop and its condition and you have to
>>> > print
>>> > "hello"
>>> >
>>> > --
>>> > You received this message because you are subscribed to the Google
>>> > Groups
>>> > "Algorithm Geeks" group.
>>> > To post to this group, send email to [email protected].
>>> > To unsubscribe from this group, send email to
>>> > [email protected].
>>> > For more options, visit this group at
>>> > http://groups.google.com/group/algogeeks?hl=en.
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected].
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to