[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Freetype] Re: const char * (was RE: Mac OS X improvements)
From: |
Dave Williss |
Subject: |
Re: [Freetype] Re: const char * (was RE: Mac OS X improvements) |
Date: |
Tue, 11 Dec 2001 13:49:22 -0600 |
----- Original Message -----
From: "Paul Miller" <address@hidden>
To: <address@hidden>
Sent: Friday, December 07, 2001 9:43 AM
Subject: Re: [Freetype] Re: const char * (was RE: Mac OS X improvements)
>
> > > I could be wrong on this one, but const isn't part of the C89
> > > standard - only the C9x one...
> >
> >Not to worry. const is C89.
>
> That's what I thought. My XML parser (http://www.fxtech.com/xmlio) uses
> const liberally and I've never had a complaint.
>
I believe that virtually all compliers these days at least accept the const
keyword and that it's been part of the standard almost from the beginning
(if not all along). The problem in the old days wasn't the compiler, but
the
standard libraries. None of the standard library functions actually took
const pointers, so if you tried to use them, you ended up having to cast
away
the const-ness.
The solution I've seen in other open source projects is to #define CONST
in a config.h and use that. For example...
#ifdef NO_CONST
#define CONST
#else
#define CONST const
#endif
void FT_Whatever(CONST char* something);
Then anybody who needs to use a compiler that doesn't understand const
can add the flag to define NO_CONST to their Makefile.
You can be sneaky and make you code look better by doing it more like...
#ifdef NO_CONST
#define const
#endif
Then just go ahead and use const.
-- Dave Williss
------
Meddle not in the affairs of dragons,
for you are crunchy and taste good with catsup
- Re: [Freetype] Question on MacOS X, (continued)
- Re: [Freetype] Question on MacOS X, Dave Williss, 2001/12/04
- [Freetype] Mac OS X improvements checked in!, Leonard Rosenthol, 2001/12/06
- RE: [Freetype] Mac OS X improvements checked in!, Changyuan Hu, 2001/12/06
- RE: [Freetype] Mac OS X improvements checked in!, Leonard Rosenthol, 2001/12/06
- RE: [Freetype] Mac OS X improvements checked in!, Paul Miller, 2001/12/06
- [Freetype] const char * (was RE: Mac OS X improvements), Leonard Rosenthol, 2001/12/06
- [Freetype] Re: const char * (was RE: Mac OS X improvements), Alan Shutko, 2001/12/06
- Re: [Freetype] Re: const char * (was RE: Mac OS X improvements), Leonard Rosenthol, 2001/12/07
- [Freetype] Re: const char * (was RE: Mac OS X improvements), Alan Shutko, 2001/12/07
- Re: [Freetype] Re: const char * (was RE: Mac OS X improvements), Paul Miller, 2001/12/07
- Re: [Freetype] Re: const char * (was RE: Mac OS X improvements),
Dave Williss <=
- RE: [Freetype] Mac OS X improvements checked in!, Changyuan Hu, 2001/12/06
- Re: [Freetype] Question on MacOS X, Sander van der Wal, 2001/12/10
- Re: [Freetype] Question on MacOS X, Paul Miller, 2001/12/10
- Re: [Freetype] Question on MacOS X, Dave Williss, 2001/12/11
- Re: [Freetype] Question on MacOS X, Leonard Rosenthol, 2001/12/11
Re: [Freetype] Question on MacOS X, Paul Miller, 2001/12/11