[Ffmpeg-devel] [PATCH] near is a special keyword

Oded Shimon ods15
Thu Mar 2 10:17:42 CET 2006


On Thu, Mar 02, 2006 at 11:12:45AM +0200, Ivan Kalvachev wrote:
> 2006/3/1, Michael Niedermayer <michaelni at gmx.at>:
> > Hi
> >
> > On Tue, Feb 28, 2006 at 03:42:26PM -1000, Steve Lhomme wrote:
> > > ...on some windows compilers (far vs near pointers). So I renamed items
> > > called "near".
> >
> > #define near smallandstinkingsoft_not_knowing_c_standard
> 
> I'm sorry but this might not work.
> It seems that if the compiler have reserved special keyword it cannot
> be redefined or undef-ed
> Here I tried this small program with gcc
> ---
> #include <stdlib.h>
> #include <stdio.h>
> 
> //#undef for
> #define for foobar
> #undef for
> 
> int main(){
>    int i;
>    for(i=0;i<10;i++)
>        printf("baka!\n");
> }
> ---
> The result, program compiles and runs just fine.
> 
> So if gcc does this I guess other inferiour compilers could do the same.

... are you high?
You defined for, and then undefined it, ofcourse this program compiles 
fine. remove the undef, and it will give you an error about the 
'foobar(;;)'. You know C preprocessor doesn't care or even know about C 
keyword at all, for all it cares everything is text.

- ods15





More information about the ffmpeg-devel mailing list