Why does toStringz return an immutable(char)*?

Jimmy Cao jcao219 at gmail.com
Sat Jun 18 13:16:35 PDT 2011


A function with a const(char)* argument can take an immutable(char)* just
fine.

On Sat, Jun 18, 2011 at 3:36 AM, Jonathan M Davis <jmdavisProg at gmx.com>wrote:

> The main purpose of toStringz is to turn a string into a char* which can be
> passed to a C function. C doesn't have immutable, and I don't see any gain
> in
> having toStringz return an immutable(char)* rather than a const(char)*.
> Does
> anyone know why it returns an immutable rather than a const? What possible
> benefit does that have?
>
> - Jonathan M Davis
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20110618/08e9171a/attachment.html>


More information about the Digitalmars-d mailing list