Bus error accessing char [] by index - OS X

BCS ao at pathlink.com
Tue Nov 6 14:06:26 PST 2007


Reply to Cam,

> Executing the following example program compiled with
> 
>> gdc stringtest.d -o stringtest
>> 
> I get a bus error on OS X accessing the char array by index (shown in
> the comments below).
> 
> I imagine this might be a gdc on OS X issue - any other ideas?
> 
> import std.stdio;
> 
> void main() {
> char[] firstname
> firstname = "Cam";
> char [] a = firstname, b = firstname;
> a[0] = 'H'; //Bus error here
> writefln(b);
> }
> cheers,
> Cam.

On linux, string literals are in read only memory space. As for OS X...???





More information about the Digitalmars-d mailing list