freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Problems with freetype.h


From: Pedriana, Paul
Subject: RE: Problems with freetype.h
Date: Mon, 22 May 2000 14:49:10 -0700

Well, I did some testing with VC++ and found that it 
appears to be broken. If you compile the example 
code below, VC++ will choke on compiling Function4() 
but no other function, including Function5(). I don't 
have another compiler handy to test this with, but 
can probably assume a conforming compiler would 
compile OK. 

I tend to think that it would be worthwhile to modify 
freetype.h in order to fix the problem, since VC++ is 
a pretty common compiler and the fix is so trivially 
easy. I dislike Microsoft's attitude towards the C/C++
langauge standard as much as anyone, but when the 
fix is trivial, it might as well be done.

class mapclass{
   int x;
};

template <class T> class maptemplate{
   int x;
};

typedef int* pint;

int Function1(int mapclass){
   return mapclass+1;
}

int Function2(int* mapclass){
   return *mapclass+1;
}

int Function3(int maptemplate){
   return maptemplate+1;
}

int Function4(int* maptemplate){
   return *maptemplate+1;
}

int Function5(pint maptemplate){
   return *maptemplate+1;
}


Paul



                -----Original Message-----
                From:   Pavel Kankovsky [mailto:address@hidden
                Sent:   Monday, May 22, 2000 1:19 PM
                To:     Pedriana, Paul
                Cc:     address@hidden
                Subject:        Re: Problems with freetype.h

                On Mon, 22 May 2000, Pedriana, Paul wrote:

                >    EXPORT_DEF(FT_Error) 
                >    FT_Outline_Get_Bitmap(FT_Library library,
                >       FT_Outline* outline, FT_Bitmap* map);
                >... 
                > These declarations cause compile failures under C++
                > because the names "map" and "matrix" are types that are
                > part of the C++ standard template library (STL). 

                Declarators can introduce variable or parameter names that
hide existing
                names, including type names and template names. A compiler
choking on such
                a declaration is broken...unless it chokes because some
broken header
                (I shall name no <windows.h> here :>) #defined the name to
something
                silly.

                BTW: IMHO, EXPORT_DEF() should be renamed to FT_EXPORT_DEF()
in
                freetype.h.

                > A trivial fix would be to simply modify the declarations
                > to use something like "map_" instead of "map", or whatever
                > would be appropriate for freetype. 

                A trivial fix would be to remove parameter names completely
but it should
                not be necessary.

                --Pavel Kankovsky aka Peak  [ Boycott
Microsoft--http://www.vcnet.com/bms ]
                "Resistance is futile. Open your source code and prepare for
assimilation."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]