[SDL] SDL_ttf not taking const pointers?

John Giors jgiors at yahoo.com
Fri Mar 31 13:56:49 PST 2006


I was going to reply that SDL_ttf is a C (not C++) library and probably doesn't
use "const"...

However, I looked at the code and it *does* use "const" in several places (at
least for const char pointers).

Also, here is the source for TTF_FontHeight():

int TTF_FontHeight(TTF_Font *font)
{
	return(font->height);
}

Obviously, "const" would work fine in this case.  Maybe you should try to
contact the SDL_ttf author.  You might even download the source and take a
crack at the changes yourself...

John Giors
Game Programmer
Pandemic Studios

> Message: 7
> Date: Wed, 29 Mar 2006 22:40:03 -0500
> From: Stea Greene <stea at cs.binghamton.edu>
> Subject: [SDL] SDL_ttf not taking const pointers?
> To: sdl at libsdl.org
> Message-ID: <20060330034003.GB11669 at cs.binghamton.edu>
> Content-Type: text/plain; charset="us-ascii"
> 
> Is there a reason SDL_ttf's various query functions (for example,
> TTF_FontHeight or TTF_FontLineSkip) don't take const pointers to
> TTF_Font structs?  They take non-const pointers, but are they actually
> modifying the struct itself?
> 
> Can these be changed to const pointers?  This would allow for cleaner
> setups using these fonts - having the ability to pass const font
> poitners without worrying (much) about someone changing them.
> 
> If this is the wrong place for SDL_ttf questions, where is that place?
> 
> Thanks.
> 
> -- 
> Steaphan Greene <sgreene at cs.binghamton.edu>
> GPG public key: http://www.cs.binghamton.edu/~sgreene/gpg.key.txt


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 




More information about the SDL mailing list