Re: [fpc-pascal] Cast, inheritance, etc

2012-12-05 Thread Chad Berchek
This is an example of why it is usually wise to use the AS operator except in performance critical places. Using the parentheses notation is an unsafe cast; type checking does not occur at the time of the cast. This is especially dangerous because you run the risk of corrupting memory by

Re: [fpc-pascal] converting a TP/BP library to FPC

2012-12-05 Thread Chad Berchek
Perhaps it would be sufficient to supply the time value from another source converted to the units the other code is expecting to see. Assuming the frequency for the BIOS timer is about 18.2 Hz: function TimeCounter: LongInt; begin Result := LongInt(Round(GetTickCount * 18.2065 / 1000));

Re: [fpc-pascal] Seems Delphi is moving to Java-style primitive types

2012-10-17 Thread Chad Berchek
It actually uses record helpers, but the end result looks very much like Java primitive types where you have type.ToString, type.Equals, type.Split etc... Not with the intent to be contrary, but for the sake of clarity in discussion, String in Java is not a primitive type; it is a full-fledged

Re: [fpc-pascal] SysUtils.GetEnvironmentVariable

2012-03-29 Thread Chad Berchek
Works fine for me on Windows 7. Here's the Windows version details: Windows 7 Pro, 64-bit, with Service Pack 1. The ver command shows 6.1.7601. I tested 3 cases: 1. Setting the environment variable using the set command in a command line prompt then immediately running the test program. 2.

Re: [fpc-pascal] Exception withing exception handling

2012-02-17 Thread Chad Berchek
On 2/17/2012 2:26 PM, Sven Barth wrote: On 17.02.2012 18:36, Jorge Aldo G. de F. Junior wrote: so i am inclined to think that exceptions arent supposed to live much longer after their corresponding try except handling block. is that true ? actually, how are exceptions raised ? can i reraise

Re: [fpc-pascal] How to poll for a byte in Input?

2011-12-09 Thread Chad Berchek
On 12/9/2011 9:44 AM, tcoq wrote: Hello, I'm trying to poll the input stream to see whether there is a new character available, without blocking my software. Maybe TInputPipeStream.NumBytesAvailable can help. You can find it in the documentation of the Pipes unit. I tried an experiment to