Recent

Author Topic: [SOLVED] Is this an error in Format?  (Read 4394 times)

garlar27

  • Hero Member
  • *****
  • Posts: 648
[SOLVED] Is this an error in Format?
« on: November 12, 2012, 05:26:54 pm »
I have this code:
Code: [Select]
Memo1.Lines.Add(Format('ThreadID=%d; IntToStr(ThreadID)=%S', [ThreadID, IntToStr(ThreadID)]));
Which has this output:
Quote
ThreadID=-1215998176; IntToStr(ThreadID)=3078969120

FPC's Newer versions have the same problem?

I'm using Lazarus 0.9.30 FPC 2.4.4

Thanks in advance.-
« Last Edit: November 15, 2012, 12:55:44 pm by garlar27 »

Bart

  • Hero Member
  • *****
  • Posts: 3911
    • Bart en Mariska's Webstek
Re: Is this an error in Format?
« Reply #1 on: November 14, 2012, 02:23:21 pm »
For me it gives (using fpc 2.6.0 32-bit on Win7-64):
Code: [Select]
ThreadID=5372; IntToStr(ThreadID)=5372

Which OS are you using?
ThreadID isn't always of type integer, it depends on OS.

Bart.

garlar27

  • Hero Member
  • *****
  • Posts: 648
Re: Is this an error in Format?
« Reply #2 on: November 14, 2012, 03:15:21 pm »
I'm using Linux 32. and ThreadID is defined as a LongWord.

Maybe the issue is already fixed in 2.6.0

Bart

  • Hero Member
  • *****
  • Posts: 3911
    • Bart en Mariska's Webstek
Re: Is this an error in Format?
« Reply #3 on: November 14, 2012, 05:42:21 pm »
Well, upgrade your fpc to 2.6.0 and give it a try and report back.

Bart

garlar27

  • Hero Member
  • *****
  • Posts: 648
Re: Is this an error in Format?
« Reply #4 on: November 14, 2012, 06:05:42 pm »
Unfortunately I can't do that for the moment.

It's been a long time since I need to upgrade my Lazarus an FPC but first I need to check I will not have problems with the components I use AND do extensive tests to my projects (due to modifications in FPC). This would take a couple of days which ATM (and since 0.9.30.2 is out) I don't have.

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: Is this an error in Format?
« Reply #5 on: November 14, 2012, 06:46:30 pm »
It works the same with FPC 2.7.1 SVN still. I found some other info though:
http://www.freepascal.org/docs-html/rtl/sysutils/format.html

%d is signed integer
%u is unsigned integer

garlar27

  • Hero Member
  • *****
  • Posts: 648
[SOLVED]: Is this an error in Format?
« Reply #6 on: November 15, 2012, 12:55:17 pm »
DOUGH!!!  :o

I Missed that part of documentation :-[ :-[ :-[ :-[

I alway have at hand the Format documentation page, and from time to time (when I need something special or different from usual) I read it again ...

  anyhow ...   %) %) %)

Thanks a lot!!!

 

TinyPortal © 2005-2018