[Bf-committers] Casting arrays (matrices)

Philipp Gühring bf-committers@blender.org
Thu, 3 Jul 2003 02:06:36 +0200


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

> > I'm with Maarten on this one.  If I gave you a prototype for a string
> > copy
> > function that read "strcyp(char *target,const char *source)" it would
> > not
> > only tell you that your source string wouldn't be modified, but it
> > would
> > allow the compiler to enforce that behavior.

;-)

The compiler: yes. 
The linker: no!

Just create your own header files without const, compile against your own 
header files, and link against the const library.

I know that because it was necessary to do that with a closed-source library.

Please use const only when you are absolutely sure that nobody ever could 
have any use of modifying it. Otherwise you create a Denial-of-Service!

And please avoid const when you design callback interfaces.

Many greetings,
- -- 
~ Philipp Gühring              p.guehring@futureware.at
~ http://www.livingxml.net/       ICQ UIN: 6588261
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE/A3ONlqQ+F+0wB3oRAk+WAJ4nSPECzidU2z3FTwBFrIEv8Nbs+ACgs1ep
Txr+tbm5T2r+7jLhQgr5tJY=
=+cyt
-----END PGP SIGNATURE-----