* * *

Recent Posts

Pages: [1] 2 3 ... 10
1
General / Re: Please make your language more freedom
« Last post by Pasqualish on Today at 07:32:57 am »
Clumping variable declarations together is an old school style - COBOL, Fortran, K&R C, Pascal, to name a few. C went away from it. Don't know about Fortran and COBOL. Would be interesting to know if they did.
2
General / Re: Please make your language more freedom
« Last post by Pasqualish on Today at 07:31:28 am »
Thr inline var should not be there to be like C, but to improve readability and prevent bugs caused by uninitialized variable.

After a for loop the loop variable must not be used without being reinitialized. "for var" makes sure you do not accidentally use the variable. Using a loop variable after a loop must be a compile error. It makes no sense that fpc compiles code that accesses a variable it knows to be invalid

And other inplace "var .. := .."  make sure the variable is initialized at its declaration. No one  needs a variable that is  uninitialized.
To a compiler engineer that makes no sense: E.G. The for part makes the implied variable always initialized and not only through type inference ...By default....Silly you... Did you really understand this....?
Usually you know your theory a bit better.... <Sigh, everybody wants to be a programmer <grumpy, can't help it,  >:D >:D > >
 That's a sheer lack of understanding how compilers work (not just Pascal compilers, any compiler!)
If you want this kind of variables (just loop invariants) these CAN be determined by the compiler based on the language and still be LL(1).
If it is a good choice, I doubt it, because of such ill informed comments.. (and you are not a troll, I know, it is also YOUR job to educate some people on this forum that have DWIM opinions.... :D :D ;D ;D O:-)).

The poster was talking about using the for loop variable after the loop, not during the loop. Usage of the variable is limited to the scope of the loop if it is defined only for the loop.
3
General / Re: Please make your language more freedom
« Last post by Pasqualish on Today at 07:29:22 am »
There's PascalABC.NET too. I liked it more from Object Free Pascal, not because it can use the full power of .NET but because I found their Pascal Dialect to be more modern and freedom than yours (just my own opinion).

(I still fail to see what "modern" has to do with imitating 1970s C syntax. The two years that Pascal is older than C can't matter that much?)

C clumped variable declarations at the top of blocks for the first 28 years of its existence. It wasn't until the C99 standard (1999 - 19 years ago) that it was decided to allow C variables to be declared anywhere in the code. So it would be emulating 1999 C syntax,  not 1970's.
4
General / Re: Display a double value (2^60) without rounding
« Last post by engkin on Today at 07:28:09 am »
I blame it on Dragons!

FPC is using Grisu1* which has, beside the above mentioned limitation, a problem related to accuracy. It is possible to fall in double-rounding errors.

* About Grisu1,2 & 3: http://www.cs.tufts.edu/~nr/cs257/archive/florian-loitsch/printf.pdf

A recent possible improvement Errol3

A widely used code comes from David Gay's dtoa.c. The author maintains the code to this day.
5
General / Re: DLL crash
« Last post by reinerr on Today at 07:12:04 am »
As already suggested, the most likely cause is freeing of memory inside the DLL that the PChars are pointing to. It may be that most of the time the memory is still valid for long enough but occasionally not.
6
FPSpreadsheet / Export to dbf
« Last post by SeregaKR on Today at 07:09:21 am »
Hello.
I would like to know if it is possible to save table in dbf format (maybe using sfUser FileFormat).

As far as I can see now the way to save data from Excel table is to parse through cells and copy data using TFpDbExport component. But I'm not sure if it's the most efficient way to do this.

Other way it seems is described in section dataset export in the wiki, but it is really vague.

Can you give any pointers in the right direction?

To clarify I need to save excel file like the one attached to the topic to dbf. All fields are known beforehand.

7
General / Re: Error: Duplicate identifier "Forms"
« Last post by reinerr on Today at 07:05:00 am »
I always give my GUI controls (including forms) a prefix - a legacy from my work. In our case, form names are usually prefixed with "FRM_", edit control names are prefixed with "EDT_", etc.
8
Win32/64 / Re: Caret stops blinking after a few seconds
« Last post by engkin on Today at 06:49:41 am »
Why do you suppose it would stop blinking?

My guess: full message queue.

Windows, internally, uses an undocumented message (WM_SYSTIMER $0118) to blink the caret beside other functions. If the queue is full, no more blinking messages are received.

If my guess is right, your application is not a simple kMemo test program.
9
General / Re: Unresponsive program
« Last post by reinerr on Today at 06:05:10 am »
Something that's not clear but from reading I assume this happens on different machines and not just one specific one running Windows 10.

As others have indicated, Application.ProcessMessages can be a problem if you're using threads and synchronizing methods and you can get locks (e.g. calling Synchronize and within the main thread waiting for the thread lock to be available).

But really you should not be waiting for "continue" like this - you should process an event when you are ready to continue.

PS. I don't like the "continue = false" - booleans should not be compared with TRUE or FALSE as they are already are - its like saying "if true = true". If you feel the need to you probably haven't named your variables well. It is better to write "while not continue do".
10
LCL / Re: How to define color constants?
« Last post by valdir.marcos on Today at 05:26:07 am »
const or vars? If they are not declared as I showed those are bugs.

his declaration is wrong in the first place.
His declaration is correct (see the declaration of the clXXX constants in unit graphics). What's wrong is that he is writing the bytes in the wrong order. In TColor the red-green-blue bytes must be read from right to left - unlike HTML where they are read from left to right.

const or vars?
Hey come on Thaddy - an experienced guy like you knows that a var cannot be declared without type.

Good to see that Thaddy can make mistakes as any of us!... :) O:-)
Pages: [1] 2 3 ... 10

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus