[Bug 91] String literals not always properly zero-terminated

gdc-bugzilla at gdcproject.org gdc-bugzilla at gdcproject.org
Sun Jan 12 09:03:57 PST 2014


http://bugzilla.gdcproject.org/show_bug.cgi?id=91

--- Comment #4 from Iain Buclaw <ibuclaw at gdcproject.org> 2014-01-12 17:03:57 GMT ---
(In reply to comment #3)
> Yes, but string _literals_ must be zero-terminated IIRC. I can't find the
> relevant docs on dlang.org but see for example this site:
> http://dlang.org/interfaceToC.html "However, string literals in D are 0
> terminated."
> 

Yes, string literals are 0 terminated when interfacing to C char* types. :)

eg:

int printf(in char *, ...);
printf("Foo");


In StringExp::toElem, "Foo" is a Tpointer type, which is constructed as a
zero-terminated string.

-- 
Configure bugmail: http://bugzilla.gdcproject.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.


More information about the D.gnu mailing list