[Aldor-l] Questions

Martin Rubey martin.rubey at univie.ac.at
Tue Nov 13 01:50:39 EST 2007


ldragan at aldor.org writes:

> Quoting Ralf Hemmecke <ralf at hemmecke.de>:
> 
> > So? That should be considered a bug, right? (And it is even terribly
> > easy to fix by replacing in sal_string.as the line
> >
> > 	string(l:Literal):% == string(l pretend Pointer);
> >
> > by
> >
> > 	string(l:Literal):% == copy string(l pretend Pointer);
> >
> > .)
> 
> Yes, this is the solution I was thinking about, but this has to be  
> done for all implementations of string function (aldor, axllib,  
> algebra?). The other solution is to clearly explain in the User's  
> Guide this behavior. Of course, there is another solution to modify  
> the compiler to add a strcpy to all string literals.

Isn't there also a performance penalty associated with "copy" or "strcpy"?  I
guess in normal situations it doesn't make any difference at all. However, once
in a while one may want to have high-performance code, so I can imagine that
then such little things may be not so good.  Personally, I can live with
immutable literals.  Hm, aren't the other literals immutable, too?  It's only
that string literals are the only ones where one usually "thinks" that one can
modify them.  But why can't I set a certain bit in an AldorInteger?

Martin




More information about the Aldor-l mailing list