[Ecls-list] How to wrap and return constant pointers with c-inline?

Matthew Mondor mm_lists at pulsar-zone.net
Sun Jul 7 16:12:31 UTC 2013


On Sun, 7 Jul 2013 17:27:38 +0200
Peter Enerccio <enerccio at gmail.com> wrote:

> Constness of a pointer, in c and c++ means absolutely nothing. It is just a
> way for programmer to self policy, same as private/public in c++/java, they
> are only for compilers to throw errors and programmers to avoid those
> errors. In memory, it is just data, and as data, in c you can force
> compiler to represent them in any way, ie cast. Anyways, glad to be help.

It can also serve as a hint to the compiler such that it may optimize
more aggressively by assuming that those will not be modified in that
scope, so not exactly nothing :)
(see http://gotw.ca/gotw/081.htm for a discussion of the possibilities
and limits of this though)

But I agree that it's most useful for humans, and with the rest,
-- 
Matt




More information about the ecl-devel mailing list