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

Peter Enerccio enerccio at gmail.com
Sun Jul 7 16:17:28 UTC 2013

Sure. memory can be read only, but that has more to do with OS, CPU
registers and segmentation, really. And it only applies to cstrings and
constant numbers, really. You cant mark class/struct in ro memory, because
even though class/struct is read only, fields will not be. And especially
in c++ you cant because you will need to write the class in at
initialization anyways. Ultimately though, pointers are just numbers, so
casts work precisely.

2013/7/7 Matthew Mondor <mm_lists at pulsar-zone.net>

> 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
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
> Build for Windows Store.
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> Ecls-list mailing list
> Ecls-list at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ecls-list

Bc. Peter Vaňušanik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20130707/eaf2ef2e/attachment.html>

More information about the ecl-devel mailing list