January 27, 2007
Walter Bright wrote:
> Bill Baxter wrote:
>> Walter Bright wrote:
>>> Bill Baxter wrote:
>>>>  > Assertion failure: 'classinfo->structsize == CLASSINFO_SIZE' on line  316 in file 'toobj.c'
>>>>  > abnormal program termination
>>>>
>>>> when I try to compile.
>>>
>>> Oops, uploaded the wrong file. Try again.
>>
>> Yay!  All happy now.
> 
> I've automated much of the process of creating an update, but there's still maddening places where I can overlook something.

Sounds like you work under Windows... :o)

Andrei
January 27, 2007
Andrei Alexandrescu (See Website For Email) wrote:
> Walter Bright wrote:
>> I've automated much of the process of creating an update, but there's still maddening places where I can overlook something.
> 
> Sounds like you work under Windows... :o)

----
urxae@urxae:~/opt/dmd/src$ file `find` | grep text | grep CRLF | wc -l
245
urxae@urxae:~/opt/dmd/src$ file `find` | grep text | grep -v CRLF | wc -l
37
-----

Yep, looks like he does (mostly) :).
January 27, 2007
Jordan Miner wrote:
> Here is a problem I've found in post-1.00 versions.

What's happening is you're writing into the string literal, which is not allowed. String literals should be regarded as readonly.

Post-1.00 versions combine identical string literals, which is why you see the error.
January 28, 2007
>>
>> Sounds like you work under Windows... :o)
>
..........
>
> Yep, looks like he does (mostly) :).

He is a smart guy who probably does not feel like
beta testing operating systems. Or maybe he just
ran out of coffee too often while waiting for penguin's
favorite compiler and linker to finish their jobs ....   ;-)



January 28, 2007
Walter Bright wrote:
> What's happening is you're writing into the string literal, which is not allowed. String literals should be regarded as readonly.

So is there a reasonable way for D to enforce this?  I haven't been following the recent const discussion in detail.  Would it help here and actually be applied to literal strings in a future D?

-Jeff
January 28, 2007
Walter Bright Wrote:

> Jordan Miner wrote:
> > Here is a problem I've found in post-1.00 versions.
> 
> What's happening is you're writing into the string literal, which is not allowed. String literals should be regarded as readonly.
> 
> Post-1.00 versions combine identical string literals, which is why you see the error.

I guess I thought that literals were allocated at runtime. Must have used Ruby too much...nothing wrong with changing its literals. I almost would like D's literals to be that way, but I can't think of a time that I'd actually want to change a literal, so it definitely wouldn't be worth the overhead.
Sorry for the mistake.

January 28, 2007
On Sat, 27 Jan 2007 16:35:23 -0500, Jordan Miner wrote:

> Here is a problem I've found in post-1.00 versions.
> I have this unittest in my library:
> 
> unittest {
> 	char[] c = "Computer";
> 	ArrayCopy!(char)(c, 3, c, 2, 4);
> 	assert(c == "Coputeer");
> 	c = "Computer";
> 	ArrayCopy!(char)(c, 2, c, 3, 4);
> 	assert(c == "Commputr");
> }

Does this work for you?

 unittest {
 	char[] c = "Computer".dup; // Take a copy of the string literal.
 	ArrayCopy!(char)(c, 3, c, 2, 4);
 	assert(c == "Coputeer");
 	c = "Computer";
 	ArrayCopy!(char)(c, 2, c, 3, 4);
 	assert(c == "Commputr");
 }


I suspect that you are trying to (inadvertantly) modify a string literal.

-- 
Derek Parnell
January 28, 2007
Jeff Nowakowski wrote:
> Walter Bright wrote:
>> What's happening is you're writing into the string literal, which is not allowed. String literals should be regarded as readonly.
> 
> So is there a reasonable way for D to enforce this?  I haven't been following the recent const discussion in detail.  Would it help here and actually be applied to literal strings in a future D?

This is enforced on Linux but not Win32.  I suspect this means it's an OS feature that Windows doesn't provide, but I've never heard anyone say for sure either way.


Sean
January 28, 2007
Bob W wrote:
>>> Sounds like you work under Windows... :o)
> ..........
>> Yep, looks like he does (mostly) :).
> 
> He is a smart guy who probably does not feel like
> beta testing operating systems. Or maybe he just
> ran out of coffee too often while waiting for penguin's
> favorite compiler and linker to finish their jobs ....   ;-)

g++ is a slow compiler, and ld is a really slow linker, and I'm just more used to windows quirks than linux quirks.

But the worst thing about linux development is gdb. gdb's user interface seems stuck in 1983 era thinking. I can't even get the thing to display the register contents. It won't pick up the program arguments from the command line. Either I'm stupid, all this is missing from the documentation, or gdb really is terrible.

I do all my debugging on windows. Even horrible old windbg is a decade ahead of gdb.

I do like gcov, though.
January 28, 2007
"Walter Bright" <newshound@digitalmars.com> wrote in message news:epgokh$2q2p$1@digitaldaemon.com...
> Jordan Miner wrote:
>> Here is a problem I've found in post-1.00 versions.
>
> What's happening is you're writing into the string literal, which is not allowed. String literals should be regarded as readonly.
>
> Post-1.00 versions combine identical string literals, which is why you see the error.

Shouldn't string literals be forced "const"? Even D's limited const could do that. To create a mutable copy you'd be forced to used .dup.

const char[] either = "asdfsadf";
char[] or = "asdfsd".dup;

L.