Re: [fpc-devel] Const optimization is a serious bug

2011-07-10 Thread Chad Berchek
Sorry for the additional post; I should have added this to my preceding message. I just want to clarify: I am trying to be very careful to distinguish between implementation and semantics. If my understanding is correct, AnsiString implementation is always pass-by-reference. The problem is

Re: [fpc-devel] Const optimization is a serious bug

2011-07-10 Thread Chad Berchek
On 7/10/2011 2:40 PM, Daniƫl Mantione wrote: However, for a new calling convention (on an existing or a new platform) it's completely up to the compiler designer what will be passed as const and what will be passed as reference. Agreed. That's why I say you can't really make assumptions: if you

Re: [fpc-devel] Const optimization is a serious bug

2011-07-10 Thread Chad Berchek
Some thoughts on the meaning of const, constref, and "constval", and how they can usefully be applied: My initial understanding of const was hazy. I have come to appreciate that it is defined, but only in a very loose way. Instead of undefined I should say ill-defined. I'm not entirely sure what

Re: [fpc-devel] Const optimization is a serious bug

2011-07-09 Thread Chad Berchek
Wow, thanks for the insults guys. I didn't realize I was so stupid. You missed my point too, BTW. According to the link given: "A constant argument is passed by reference if its size is larger than a pointer." So you always know what the size of a pointer is? If I have this record: TMyRec =

Re: [fpc-devel] Const optimization is a serious bug

2011-07-08 Thread Chad Berchek
Martin wrote: - See difference to normal "const" is " that it must be passed by reference." I had not read about it before, but I think constref is a huge step in the right direction. It eliminates my fundamental grief with the current implementation. Specifically, the way const is now "def

Re: [fpc-devel] Const optimization is a serious bug

2011-07-07 Thread Chad Berchek
I have just written up some very compelling arguments and then decided to scrap it. I maintain that const strings, dynamic arrays, and interfaces, as currently implemented, are dangerous and should be considered useless in all but the most limited circumstances. The behavior is dependent upon

Re: [fpc-devel] Const optimization is a serious bug

2011-07-06 Thread Chad Berchek
I have some observations on the discussion so far. The biggest question is what the intended behavior is. Martin wrote: Well, I have pointed out myself,in my mail, that it probably needs more documentation. I do not know if it is documented or not. But it is the answer, I have gotten several t

Re: [fpc-devel] Const optimization is a serious bug

2011-07-04 Thread Chad Berchek
Max wrote: It's subjective on my side, but If it existed so many years in borland/inprise/embarcadero products and I can not remember my own bug fixes related to something like this, I consider your example more artificial than one might think. I understand what you're saying, and I had the sam

[fpc-devel] Const optimization is a serious bug

2011-07-04 Thread Chad Berchek
I've been reading over some of the recent discussion about reference counting problems with const string parameters. I've done some experiments and I believe that the so-called const optimization is a serious flaw, not just a corner case of questionable legitimacy. I have some sample code I will s

[fpc-devel] Stream bug fixes & refactoring - multiple tickets & patches or one?

2011-05-24 Thread Chad Berchek
e are probably a dozen distinct bugs, but many overlap. Please advise me on how things are done here. Thanks. Chad Berchek ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel