Re: [fpc-devel] SQLite and ftFmtBCD

2011-05-11 Thread LacaK
or better: ftFmtBCD: begin if P.AsFMTBCD.Precision 15 then //we are out of REAL range, so we must bind as BLOB begin s tr1=BCDTOStrP.AsFMTBCD,SQLFormatSettings); checkerror(sqlite3_bind_blob(fstatement,I,pcharstr(str1), length(str1),

Re: [fpc-devel] Declare variables inside the code

2011-05-11 Thread Marco van de Voort
In our previous episode, Joerg Schuelke said: The reason for C++ to say a declaration is a statement is coding security. I always thought the main reason was because C did it that way, and C++ is C backwards compat. And C did it because it wanted to save stack space in the minis of the early

Re: [fpc-devel] Declare variables inside the code

2011-05-11 Thread Joerg Schuelke
Am Wed, 11 May 2011 09:30:21 +0200 (CEST) schrieb mar...@stack.nl (Marco van de Voort): I always thought the main reason was because C did it that way, and C++ is C backwards compat. And C did it because it wanted to save stack space in the minis of the early seventies. The rest is IMHO

Re: [fpc-devel] Declare variables inside the code

2011-05-11 Thread Michael Schnell
On 05/11/2011 09:30 AM, Marco van de Voort wrote: And C did it because it wanted to save stack space in the minis of the early seventies. Independently from the location a local variable has been declared, the compiler can decide in what section of the code it reserves stack place for it. IMHO

Re: [fpc-devel] Declare variables inside the code

2011-05-11 Thread Joerg Schuelke
Am Wed, 11 May 2011 09:30:21 +0200 (CEST) schrieb mar...@stack.nl (Marco van de Voort): In our previous episode, Joerg Schuelke said: The reason for C++ to say a declaration is a statement is coding security. But all that was not the question, implementing the desired feature is in my

Re: [fpc-devel] Declare variables inside the code

2011-05-11 Thread Marco van de Voort
In our previous episode, Joerg Schuelke said: And C did it because it wanted to save stack space in the minis of the early seventies. The rest is IMHO revisionism. Ok, not the reason. But coding security is the reason, you should do so, if you can. Look at Stroustrup. The reason for pascal

Re: [fpc-devel] Declare variables inside the code

2011-05-11 Thread Joerg Schuelke
Am Wed, 11 May 2011 10:21:45 +0200 (CEST) schrieb mar...@stack.nl (Marco van de Voort): FPC is much lighter on that, and never runs constructors automatically. It only initializes some pointer values to NIL. So you'll have to explain that remark in more detail. _ Yes, today. What I mean

Re: [fpc-devel] Declare variables inside the code

2011-05-11 Thread Michael Schnell
On 05/11/2011 11:39 AM, Joerg Schuelke wrote: 1. You decide it is nice to declare variables where you need them. Readability problems might arise regarding the scope of equally named variables. Pascal ovoid much of this. -Michael ___ fpc-devel

Re: [fpc-devel] Declare variables inside the code

2011-05-11 Thread Joerg Schuelke
Am Wed, 11 May 2011 12:26:09 +0200 schrieb Michael Schnell mschn...@lumino.de: Readability problems might arise regarding the scope of equally named variables. Pascal ovoid much of this. I agree, and somebody will then come and suggest: Lets do it this way. var a:integer; begin some code

Re: [fpc-devel] Declare variables inside the code

2011-05-11 Thread Hans-Peter Diettrich
kingbiz...@gmail.com schrieb: I would like to be able this: [ some code after begin ] DoSomething; var I: Integer; for I := 0 to 1000 do DoAnotherThing(I); [ inside the code ] That's not good practice, in no programming language. Better move the loop into a local procedure, where you can

Re: [fpc-devel] Declare variables inside the code

2011-05-11 Thread Hans-Peter Diettrich
Joerg Schuelke schrieb: Am Tue, 10 May 2011 23:50:29 +0200 schrieb Hans-Peter Diettrich drdiettri...@aol.com: The syntax would look like: Block = BEGIN [Declarations] {Statement} END . Yea, it looks like C, but it is not. The difference in C like languages is that an declaration is just a

Re: [fpc-devel] Declare variables inside the code

2011-05-11 Thread Hans-Peter Diettrich
kingbiz...@gmail.com schrieb: I don't see any disadvantage writting a code with /C-like with pascal keywords/, shortcuts are always welcome in order to code faster (also this is the objective of the High-Level Languages, isn't?). I like Pascal and I don't see why to resist against some

Re: [fpc-devel] Declare variables inside the code

2011-05-11 Thread Hans-Peter Diettrich
Joerg Schuelke schrieb: To decide that a declaration is a statement and can occur everywhere where a statement is required, is not that small you think. This has many consequences, influencing the whole code generation process. Think about exceptions and stack rewinding. Right, but a

Re: [fpc-devel] Declare variables inside the code

2011-05-11 Thread Hans-Peter Diettrich
Michael Schnell schrieb: IMHO the reason is reusing the variable name, which in C can be essential with complex macro declarations. You can reintroduce any variable name in a {-} block without harming the variable with the same name declared outside and used before and after the block .

Re: [fpc-devel] Declare variables inside the code

2011-05-11 Thread Hans-Peter Diettrich
Joerg Schuelke schrieb: Ok, not the reason. But coding security is the reason, you should do so, if you can. Look at Stroustrup. The reason for pascal not to do so, is what follows from that, a really complicated stack unwinding, for example. Stack unwinding is not an argument, IMO. C++ and

Re: [fpc-devel] Declare variables inside the code

2011-05-11 Thread Hans-Peter Diettrich
Joerg Schuelke schrieb: Am Wed, 11 May 2011 00:23:13 +0200 schrieb Vinzent Höfler jellyfish.softw...@gmx.net: I would. FPC already has interfaces. There are good reasons why most languages didn't adopt the C++-way of doing MI. I think we have two concepts - inheritance - interface You

Re: [fpc-devel] Declare variables inside the code

2011-05-11 Thread Michael Schnell
On 05/11/2011 01:12 PM, Hans-Peter Diettrich wrote: As the downside a macro can use variables without declarations, so that the coder is responsible for providing according declarations for every such macro expansion. You need to be very silly to do this :-) . -Michael

Re: [fpc-devel] Declare variables inside the code

2011-05-11 Thread Michael Schnell
On 05/11/2011 12:35 PM, Hans-Peter Diettrich wrote: It's a very bad idea to think C, write Pascal, because such a translation will fail for any number of subtle differences between C and Pascal. and what about think Pascal write C ? Is this not Java GDR :-P . -Michael

Re: [fpc-devel] Declare variables inside the code

2011-05-11 Thread Joerg Schuelke
Am Wed, 11 May 2011 13:12:22 +0200 schrieb Hans-Peter Diettrich drdiettri...@aol.com: FPC macros don't have parameters, for this and other reasons. That's not a hard restriction, because inline procedures can be used instead, in many cases. Hmmm, I think about macros for pascal with

Re: [fpc-devel] Declare variables inside the code

2011-05-11 Thread Joerg Schuelke
Am Wed, 11 May 2011 12:28:29 +0200 schrieb Hans-Peter Diettrich drdiettri...@aol.com: Otherwise a declaration list is accepted only at the *begin* of a compound statement, not inside a statement list: compound_stat: '{' [decl_list] [stat_list] '}' ; I thought that statement =

Re: [fpc-devel] Declare variables inside the code

2011-05-11 Thread Jonas Maebe
On 11 May 2011, at 14:35, Joerg Schuelke wrote: Hmmm, I think about macros for pascal with parameters for some time, and ask you now: where is the debugging macro used inside the whole compiler sources? Nowhere, because it is nearly impossible to write some really useful. I think the

Re: [fpc-devel] Declare variables inside the code

2011-05-11 Thread Joerg Schuelke
Am Wed, 11 May 2011 14:52:13 +0200 schrieb Jonas Maebe jonas.ma...@elis.ugent.be: but I'm personally not missing anything as far as compiler development is concerned. You use an IDE? But what without? The language is the one and the IDE is the other. There are plenty of users who do not

Re: [fpc-devel] Declare variables inside the code

2011-05-11 Thread Jonas Maebe
On 11 May 2011, at 14:59, Joerg Schuelke wrote: Am Wed, 11 May 2011 14:52:13 +0200 schrieb Jonas Maebe jonas.ma...@elis.ugent.be: but I'm personally not missing anything as far as compiler development is concerned. You use an IDE? But what without? The language is the one and the IDE is

Re: [fpc-devel] Declare variables inside the code

2011-05-11 Thread Michael Schnell
On 05/11/2011 02:52 PM, Jonas Maebe wrote: I wish I could do this with macro support, but unfortunately that's not possible so I have to do it in another and less convenient way while working on the compiler. Some of the stuff that in ANSI C needs to (and can) be done with macros can be

Re: [fpc-devel] Declare variables inside the code

2011-05-11 Thread Joerg Schuelke
Am Wed, 11 May 2011 15:08:45 +0200 schrieb Jonas Maebe jonas.ma...@elis.ugent.be: I don't use any kind of automatic code generation/writing functionality of any IDE or editor (and I edit the FPC compiler sources with Lazarus, Text Wrangler, vim and nano depending on what I'm doing or

Re: [fpc-devel] Declare variables inside the code

2011-05-11 Thread Dariusz Mazur
W dniu 2011-05-11 11:39, Joerg Schuelke pisze: Am Wed, 11 May 2011 10:21:45 +0200 (CEST) schrieb mar...@stack.nl (Marco van de Voort): FPC is much lighter on that, and never runs constructors automatically. It only initializes some pointer values to NIL. So you'll have to explain that remark

Re: [fpc-devel] Declare variables inside the code

2011-05-11 Thread Jonas Maebe
On 11 May 2011, at 15:22, Joerg Schuelke wrote: Would not it be helpful to leave the debugging code in the source, and let him vanish through a conditional define? The compiler has such code, between {$ifdef EXTDEBUG}. Having full- fledged macro support would not really make most of that

Re: [fpc-devel] Declare variables inside the code

2011-05-11 Thread Florian Klaempfl
Am 11.05.2011 14:52, schrieb Jonas Maebe: but I'm personally not missing anything as far as compiler development is concerned. Me neither. And if I really need output during compilation, I add the needed code manually like printnode(self); to get a node tree at a particular place. Having

Re: [fpc-devel] Declare variables inside the code

2011-05-11 Thread Joerg Schuelke
Am Wed, 11 May 2011 16:56:38 +0200 schrieb Florian Klaempfl flor...@freepascal.org: to get a node tree at a particular place. Having this in macros everywhere makes imo no sense because one would gets an incredible amount of data. OK, to make it concrete, I refer to an level driven debug

Re: [fpc-devel] Declare variables inside the code

2011-05-11 Thread Jonas Maebe
On 11 May 2011, at 17:50, Joerg Schuelke wrote: Switched by DBGLEV:=3 for example. Programming in C I usually have a stack of debug levels, so I can for example code: DBGPUSH(4); call to whatever; DBGPOP; and all that stuff vanishes with -dNODEBUG. For the compiler itself such things

Re: [fpc-devel] Declare variables inside the code

2011-05-11 Thread Joerg Schuelke
Am Wed, 11 May 2011 17:56:39 +0200 schrieb Jonas Maebe jonas.ma...@elis.ugent.be: For the compiler itself such things are toggled via command line switches (-vc, -vt, -vu, -vd, -vp, ...). That must be some kind of misunderstanding I know the compiler switches, I spoke about runtime debugging

Re: [fpc-devel] Declare variables inside the code

2011-05-11 Thread Hans-Peter Diettrich
Joerg Schuelke schrieb: Hmmm, I think about macros for pascal with parameters for some time, and ask you now: where is the debugging macro used inside the whole compiler sources? Nowhere, because it is nearly impossible to write some really useful. The parameters are not the problem. They are

Re: [fpc-devel] Declare variables inside the code

2011-05-11 Thread Flávio Etrusco
On Tue, May 10, 2011 at 1:26 PM, kingbiz...@gmail.com kingbiz...@gmail.com wrote: I have been playing on other languages sometimes and I see some features that speed-up a lot the code creating. I'm posting here one, I want to see what you think about it. Good: fast algorithm testings, code

Re: [fpc-devel] Declare variables inside the code

2011-05-11 Thread Joerg Schuelke
Am Wed, 11 May 2011 19:11:40 +0200 schrieb Hans-Peter Diettrich drdiettri...@aol.com: Since that time I don't wonder any more, why a C compiler spends 50% of its time in scanning (and preprocessing) the input. I would introduce a macro expansion trough a compiler directive. Then there is no

Re: [fpc-devel] Declare variables inside the code

2011-05-11 Thread Vinzent Höfler
On Wed, 11 May 2011 12:07:31 +0200, Hans-Peter Diettrich drdiettri...@aol.com wrote: kingbiz...@gmail.com schrieb: I would like to be able this: [ some code after begin ] DoSomething; var I: Integer; for I := 0 to 1000 do DoAnotherThing(I); [ inside the code ] That's not good practice, in

Re: [fpc-devel] Declare variables inside the code

2011-05-11 Thread Marco van de Voort
In our previous episode, Joerg Schuelke said: That must be some kind of misunderstanding I know the compiler switches, I spoke about runtime debugging informations, not compile time. And most of the switches generate compile time ones. Am I wrong? Well, that's the fun of compiler

Re: [fpc-devel] Declare variables inside the code

2011-05-11 Thread kingbiz...@gmail.com
Em 11/05/2011 17:01, Vinzent Höfler escreveu: On Wed, 11 May 2011 12:07:31 +0200, Hans-Peter Diettrich drdiettri...@aol.com wrote: kingbiz...@gmail.com schrieb: I would like to be able this: [ some code after begin ] DoSomething; var I: Integer; for I := 0 to 1000 do DoAnotherThing(I); [