[Bf-committers] Casting arrays (matrices)

Hans Lambermont bf-committers@blender.org
Thu, 3 Jul 2003 00:02:15 +0200

Douglas Toltzman wrote:

> I'm with Maarten on this one.

as am I.

> 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.
That's an important feature indeed. Ton is not interested in it AFAIK.

> The "const" modifier is a great documentation feature, at the very
> minimum, and provides an additional level of protection from coding
> errors at best.  Incidentally, it also helps the optimizer.

The warnings must have been caused by something else, which probably was
only 'exposed' because the compiler knew more about the type of pointers
than without the const.
Don't kill the messenger, instead finish the prototyping properly.

/me shuts up now

http://lambermont.webhop.org/   () ascii ribbon campaign - against HTML mail,
                                /\ vCards and proprietary formats