expected array behaviour

Anders F Björklund afb at algonet.se
Fri Jan 2 00:59:12 PST 2009


John Reimer wrote:

>> You'd get a runtime error if you were using Linux.  For some reason
>> string literals are not read-only, or Windows doesn't respect it, or
>> something like that.  Modifying either array1 or array2 is technically
>> illegal.  So, uh, don't do it.
> 
> Yes, that's one advantage to Linux.  String literals aren't read-only on 
> Win32.  This is unfortunate because it means that these sort of bugs are 
> significantly harder to diagnose on Windows than on Linux.  I remember 
> that this was a bug in a early DUI version (now GtkD).  It's was pretty 
> easy to spot on Linux because of the runtime error.

The string literals are read-only on GDC for Win32 too, if that helps...

--anders


More information about the Digitalmars-d-learn mailing list