Re: [fpc-devel] Default IntToStr operator for '+' symbol.
- Original Message - From: Felipe Monteiro de Carvalho felipemonteiro.carva...@gmail.com To: FPC developers' list fpc-devel@lists.freepascal.org Sent: Friday, 29 April, 2011 10:23 AM Subject: Re: [fpc-devel] Default IntToStr operator for '+' symbol. The Pascal way to avoid using too much IntToStr is: begin s := Format('%d %d', [X, Y]); end; Much shorter, no? Barely, I absolutely hate that function, it's very unnatural and reminds me of C. It's pretty stupid though sometimes it can be handy to layout floats or currency or do special things, like add zeros in front. However I suspect there is a better way to layout these variables. I just had an idea how to better layout floats and such. The old way of laying them out in writeln can be used which I love and is great: Example: begin s := vSomeFloat:16:16 + ' ' + vSomeFloat:16:16; end; Perhaps someone can (later) come up with nice format specifiers. There is also a huge benefit of this new way above: The format specifier is immediatly associated with the variables no need to count place like in your case. (For two that is not much of a problem but it gets a bit nasty for 10 and beyond) Bye, Skybuck. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] type pointer to record before record.
- Original Message - From: Florian Klaempfl flor...@freepascal.org To: FPC developers' list fpc-devel@lists.freepascal.org Sent: Friday, 29 April, 2011 15:57 PM Subject: Re: [fpc-devel] type pointer to record before record. Am 29.04.2011 15:51, schrieb Flávio Etrusco: type TMyRecord = record mPrev : ^TMyRecord; // not allowed. end; Marco, only if you happen to know from the top of your head, would it be possible and without consequences to allow this kind of construction? (i.e. a pointer reference to itself) No. Because TMyRecord could be already defined in another unit. Unit1.TMyRecord Unit2.TMyRecord is allowed as long as both units do not reference each other. In case one of the two units reference each other there would probably be an error message that TMyRecord is already declared and that there is a conflict. Therefore this error situation that you fabricated is already caught by the compilers at least I know Delphi will. Perhaps you are referring to a problem inside the compiler in relation with the symbol table, in that case an easy fix would be to apply: Unit1.TMyRecord, Unit2.TMyRecord so place unit name in front of symbol, but this is probably already done since this is legal as long as they not referencing each other. Bye, Skybuck. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Default IntToStr operator for '+' symbol.
Op Fri, 29 Apr 2011, schreef Skybuck Flying: I just had an idea how to better layout floats and such. The old way of laying them out in writeln can be used which I love and is great: Example: begin s := vSomeFloat:16:16 + ' ' + vSomeFloat:16:16; end; Good, then you really need to look into writestr, as Florian wrote, you will like it: writestr(s,vSomeFloat:16:16,' ',vSomeFloat:16:16); ... works fine. Daniël___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel