Bus error accessing char [] by index - OS X

Regan Heath regan at netmail.co.nz
Wed Nov 7 02:24:41 PST 2007


Cam MacRae wrote:
> BCS Wrote:
> 
>> Reply to Cam,
>> 
>> 
>> On linux, string literals are in read only memory space. As for OS
>> X...???
>> 
>> 
> 
> Thanks mate - that could be it. I was just following along the D
> Transition guide (http://en.wikibooks.org/wiki/D_Transition_Guide).
> Perhaps it's out of date...

More like "windows centric" as string literals can be written to on windows.

Simple fix:

         char[] a = firstname.dup, b = firstname;
         a[0] = 'H'; //5

but perhaps dup needs to be introduced or explained before being used 
here...

Regan



More information about the Digitalmars-d mailing list