[Openal-devel] Setting of attributes and constness

Chris Robinson chris.kcat at gmail.com
Mon Jun 23 11:43:17 PDT 2008


On Monday 23 June 2008 10:35:45 am Matt Calabrese wrote:
> I've noticed that the use of const in OpenAL is seemingly nonexistant. For
> instance, the "fv" and "iv" family of attribute setting functions take a
> pointer-to-non-const, however, these pointed-to values are not to be
> changed by the implementation, so why are they not const? This is
> particularly frustrating for a program which is passing const data around
> since the user of OpenAL now has to either change their program to not use
> const, which is definitely not an option for many [most] applications, or
> they'd have to do potentially unsafe casts (casting away constness of an
> object which was initially declared as being const technically has
> undefined results according to the standard if I recall correctly, though
> I'm not certain without checking). Either way, this would be solved by
> simply making these parameters pointers to const data rather than pointers
> to non-const data. The change is backwards-compatible.

Hi Matt.

What headers are you using? The headers I have here (which come from the SVN 
repo) are properly marked const:
AL_API void AL_APIENTRY alSourcefv( ALuint sid, ALenum param, const ALfloat* 
values );
AL_API void AL_APIENTRY alSourceiv( ALuint sid, ALenum param, const ALint* 
values );
AL_API void AL_APIENTRY alBufferfv( ALuint bid, ALenum param, const ALfloat* 
values );
AL_API void AL_APIENTRY alBufferiv( ALuint bid, ALenum param, const ALint* 
values );


More information about the Openal-devel mailing list