Hi There,
If you declare this:
procedure proc(param: array of const);
Then you can pass any type of varaible to param, however, only in an array,
such as proc([1, 2]);
Is it possible to achieve the effect of the code below (which is wrong):
procedure proc(p1: const; p2: const);
So that: 1)
On 9/23/13, Martin laza...@mfriebe.de wrote:
So the question is, what does or should do RomanToInt for invalid input?
Probably return 0.
Romans seemed to have no zero at all.
It also will not break backwards compatibility, current
implementatiosn returns zero if an invalid character is found
On 9/23/13, Alberto Narduzzi albertonardu...@yahoo.com wrote:
Are you sure regarding M considering there is no symbol for 5000? Or
didn't Romans count to more than 5000 - 1?
yes I am. as 5000 - 1 would need to be written CMXCIX, which has the
4-M-in-a-row, that is invalid, as a maximum
In our previous episode, Martin said:
they are not ambiguous, they are simply INVALID.
So the question is, what does or should do RomanToInt for invalid input?
Raise an exception and have a try* version to avoid the exception, just like
all other str*tonumeric functions.
On 9/23/13, Alberto Narduzzi albertonardu...@yahoo.com wrote:
But IsValidRoman is as good as a solution too, indeed...
Trying to determine if it is valid is 90% of calculating the output.
Hence my previous approach of TryRomanToInt.
It returns FALSE if the string isn't a legal Roman numeral.
On Tue, 24 Sep 2013, Xiangrong Fang wrote:
Hi There,
If you declare this:
procedure proc(param: array of const);
Then you can pass any type of varaible to param, however, only in an array,
such as proc([1, 2]);
Is it possible to achieve the effect of the code below (which is wrong):
On 9/24/13, Marco van de Voort mar...@stack.nl wrote:
Raise an exception
This will break existing implementations that either expect IM to be
999, or ABC to be 0 (indicating failure), and that certainly do not
expect that this function throws an exception at them.
and have a try* version to
In our previous episode, Bart said:
Raise an exception
This will break existing implementations that either expect IM to be
999, or ABC to be 0 (indicating failure), and that certainly do not
expect that this function throws an exception at them.
Yes, but since the routine probably has low
Thanks, this works, sort of. But does not meet my needs, I will pass in
either an int value or an object, but Variant is not compatible with
TObject.
Alternatively, this also does NOT work: array [0..1] of const; no matter
it is a type definition or used as function parameter.
This is a
On Tue, 24 Sep 2013, Xiangrong Fang wrote:
Thanks, this works, sort of. But does not meet my needs, I will pass in
either an int value or an object, but Variant is not compatible with TObject.
You could make it so using a custom variant manager or operator overloading,
but this requires
On 24/09/2013 08:57, Bart wrote:
On 9/23/13, Martin lazarus-ort+dvltiveelga04la...@public.gmane.org wrote:
So the question is, what does or should do RomanToInt for invalid input?
Probably return 0.
Romans seemed to have no zero at all.
It also will not break backwards compatibility,
How does one convert from the numeric value returned by SocketError to
the name of the error (specifically, to e.g. EsockEINVAL rather than
EsysEINVAL, i.e. to be in line with the definition of functions like
fpbind)?
I notice that the example for fpconnect at
On 9/24/13, Marco van de Voort mar...@stack.nl wrote:
And let's not beat about the bush: the main reason for the routine is to
show beginning programmers that their homework can be done using a fixed
function :-)
LOL
Bart
___
fpc-pascal maillist -
On 24/09/2013 09:09, Marco van de Voort wrote:
In our previous episode, Bart said:
Raise an exception
This will break existing implementations that either expect IM to be
999, or ABC to be 0 (indicating failure), and that certainly do not
expect that this function throws an exception at
On 23/09/2013 23:34, Alberto Narduzzi wrote:
I don't believe though Romans knew negative numbers.
Well, they could subtract, couldn't they :)
But I'm certainly not an expert on the matter.
never though about, but if the only matter is DEBT, then just write
positive numbers under the DEBT
2013/9/24 Reinier Olislagers reinierolislag...@gmail.com
On 23/09/2013 23:34, Alberto Narduzzi wrote:
I don't believe though Romans knew negative numbers.
Well, they could subtract, couldn't they :)
But I'm certainly not an expert on the matter.
never though about, but if the only
2013/9/24 Reinier Olislagers reinierolislag...@gmail.com
On 24/09/2013 09:09, Marco van de Voort wrote:
In our previous episode, Bart said:
Raise an exception
This will break existing implementations that either expect IM to be
999, or ABC to be 0 (indicating failure), and that
In our previous episode, Reinier Olislagers said:
Yes, but since the routine probably has low utilisation I choose for
structuring all conversion routines all the same.
I would rather choose for maintaining backward compatiblity, the *de
facto behaviour* (return 0 on invalid values) as it
Hi All,
say, I have a class TTreeT; in the destructor of that class, is it
possible to know the actual type of T? I want to do things like:
generic TTreeT = class
public
Data: T;
destructor Destroy; override;
end;
destructor TTree.Destroy;
begin
... ...
if Data is TObject then
Am 24.09.2013 11:07, schrieb Frederic Da Vitoria:
2013/9/24 Reinier Olislagers reinierolislag...@gmail.com
mailto:reinierolislag...@gmail.com
On 24/09/2013 09:09, Marco van de Voort wrote:
In our previous episode, Bart said:
Raise an exception
This will break existing
On Tue, 24 Sep 2013, Mark Morgan Lloyd wrote:
How does one convert from the numeric value returned by SocketError to the
name of the error (specifically, to e.g. EsockEINVAL rather than EsysEINVAL,
i.e. to be in line with the definition of functions like fpbind)?
use the errors unit.
On 24/09/2013 11:07, Frederic Da Vitoria wrote:
2013/9/24 Reinier Olislagers reinierolislag...@gmail.com
mailto:reinierolislag...@gmail.com
On 24/09/2013 09:09, Marco van de Voort wrote:
In our previous episode, Bart said:
Moreover I don't think that first attempts should
Am 24.09.2013 11:19, schrieb Xiangrong Fang:
Hi All,
say, I have a class TTreeT; in the destructor of that class, is it
possible to know the actual type of T? I want to do things like:
generic TTreeT = class
public
Data: T;
destructor Destroy; override;
end;
destructor TTree.Destroy;
Am 24.09.2013 11:25, schrieb Sven Barth:
Am 24.09.2013 11:19, schrieb Xiangrong Fang:
Hi All,
say, I have a class TTreeT; in the destructor of that class, is it
possible to know the actual type of T? I want to do things like:
generic TTreeT = class
public
Data: T;
destructor Destroy;
On 24/09/2013 11:11, Marco van de Voort wrote:
In our previous episode, Reinier Olislagers said:
Yes, but since the routine probably has low utilisation I choose for
structuring all conversion routines all the same.
I would rather choose for maintaining backward compatiblity, the *de
facto
On 23/09/13 21:03, silvioprog wrote:
How do I stop the socket before finishing my application?
I've been unsuccessful with that myself, and mentioned it to Michael van
Canneyt. I tried everything I could thing of, and nothing worked. I was
using Windows. I haven't tested under Linux or FreeBSD
On Tue, 24 Sep 2013, Graeme Geldenhuys wrote:
On 23/09/13 21:03, silvioprog wrote:
How do I stop the socket before finishing my application?
I've been unsuccessful with that myself, and mentioned it to Michael van
Canneyt. I tried everything I could thing of, and nothing worked. I was
But it's not a good idea as you'd still need to convert Data to a TObject
(e.g. by using a cast), but that will fail if Data is something else than a
pointer-like type...
This worked in my TTree class (destructor):
if PTypeInfo(TypeInfo(Data))^.Kind = tkObject then TObject(Data).Free;
I
How does one convert from the numeric value returned by SocketError to
the name of the error (specifically, to e.g. EsockEINVAL rather than
EsysEINVAL, i.e. to be in line with the definition of functions like
fpbind)?
use the errors unit. (specific for unix)
It has a functiun strerror()
On Tue, 24 Sep 2013, Mark Morgan Lloyd wrote:
How does one convert from the numeric value returned by SocketError to the
name of the error (specifically, to e.g. EsockEINVAL rather than
EsysEINVAL, i.e. to be in line with the definition of functions like
fpbind)?
use the errors unit.
if not, is there a clean and easy way to initialize the entire record
memory space to zeros e.g.
constructor TMyRecord.Create(TheValue : Integer);
begin
FillChar(self, sizeof(Self), 0);
Value := TheVal;
end;
Is there a Self variable for advanced record methods/constructors ?
By the way,
If in doubt, why not to use the old-school records and an
init-value procedure.
thanks,
Dmitry
On Tuesday, September 24, 2013, Dennis Poon wrote:
**
if not, is there a clean and easy way to initialize the entire record
memory space to zeros e.g.
constructor TMyRecord.Create(TheValue :
On 23/09/13 17:18, Bart wrote:
On 9/23/13, Lukasz Sokol el.es...@gmail.com wrote:
function TryRomanToInt(AInput:String; out AResult: integer):boolean;
var i, Len, N, Np1 : integer;
[snip]
if N = Np1 then AResult := AResult + N
else AResult := AResult - N;
end;
Am 24.09.2013 11:53, schrieb Xiangrong Fang:
But it's not a good idea as you'd still need to convert Data to a
TObject (e.g. by using a cast), but that will fail if Data is
something else than a pointer-like type...
This worked in my TTree class (destructor):
if
Am 24.09.2013 11:27, schrieb Reinier Olislagers:
On 24/09/2013 11:11, Marco van de Voort wrote:
In our previous episode, Reinier Olislagers said:
Yes, but since the routine probably has low utilisation I choose for
structuring all conversion routines all the same.
I would rather choose for
does Advanced Record constructor automatically zero all the memory
space of that record?
No, it does not. Neither in Delphi nor in FPC.
Am 24.09.2013 12:36, schrieb Dennis Poon:
if not, is there a clean and easy way to initialize the entire record
memory space to zeros e.g.
constructor
Sorry, Philippe, but I can't read your messages. :(
Date: Mon, 23 Sep 2013 10:39:20 -0300
From: Philippe phili...@quarta.com.br
Subject: Re: [fpc-pascal] Re: Problems reading some of the messages
fromthis mailing list
To: FPC-Pascal users discussions fpc-pascal@lists.freepascal.org
Just a guess here, but I would think there have now been more posts in this
thread than the total number of programs to use this function. Probably by
a wide margin.
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
Am 24.09.2013 13:26, schrieb Guillermo Martínez:
Sorry, Philippe, but I can't read your messages. :(
Could you send the complete source code of such a mail to - at best -
fpc-other (additionally zipped to avoid any conversion)? So that Tomas
or someone else can have a look at it.
Regards,
On 24/09/2013 13:13, Sven Barth wrote:
Am 24.09.2013 11:27, schrieb Reinier Olislagers:
On 24/09/2013 11:11, Marco van de Voort wrote:
In our previous episode, Reinier Olislagers said:
Yes, but since the routine probably has low utilisation I choose for
structuring all conversion routines all
Am 24.09.2013 13:47, schrieb Reinier Olislagers:
On 24/09/2013 13:13, Sven Barth wrote:
Am 24.09.2013 11:27, schrieb Reinier Olislagers:
On 24/09/2013 11:11, Marco van de Voort wrote:
In our previous episode, Reinier Olislagers said:
Yes, but since the routine probably has low utilisation I
Hi,
When calling fpc -d foo test.pas there are two mistakes:
First the -d parameter is missing a value, which fpc silently ignores.
And second there are two files to compile. FPC ignores that too, gives
a hint, but compiles anyway.
Design or bug?
Mattias
On 24 Sep 2013, at 14:17, Mattias Gaertner wrote:
When calling fpc -d foo test.pas there are two mistakes:
First the -d parameter is missing a value, which fpc silently ignores.
And second there are two files to compile. FPC ignores that too, gives
a hint, but compiles anyway.
Design or bug?
In our previous episode, Reinier Olislagers said:
facto behaviour* (return 0 on invalid values) as it is quite sensible
for this kind of numbers.
It is non-orthogonal.
What is non-orthogonal?
RomanToInt uses 0 to signal error, other xxxtoint functions throw
exceptions.
Because that
Am 24.09.2013 14:17, schrieb Mattias Gaertner:
Hi,
When calling fpc -d foo test.pas there are two mistakes:
First the -d parameter is missing a value, which fpc silently ignores.
And second there are two files to compile. FPC ignores that too, gives
a hint, but compiles anyway.
Design or bug?
On Tue, 24 Sep 2013 14:23:52 +0200
Jonas Maebe jonas.ma...@elis.ugent.be wrote:
On 24 Sep 2013, at 14:17, Mattias Gaertner wrote:
When calling fpc -d foo test.pas there are two mistakes:
First the -d parameter is missing a value, which fpc silently ignores.
And second there are two
On 24 Sep 2013, at 14:34, Mattias Gaertner wrote:
On Tue, 24 Sep 2013 14:23:52 +0200
Jonas Maebe jonas.ma...@elis.ugent.be wrote:
By design, FPC gives a warning (not a hint) when two file names are
specified.
You are right, it is a warning.
Why not an error?
FPC used to silently ignore
2013/9/24 Graeme Geldenhuys gra...@geldenhuys.co.uk
On 23/09/13 21:03, silvioprog wrote:
How do I stop the socket before finishing my application?
I've been unsuccessful with that myself, and mentioned it to Michael van
Canneyt. I tried everything I could thing of, and nothing worked. I was
2013/9/24 Michael Van Canneyt mich...@freepascal.org
On Tue, 24 Sep 2013, Graeme Geldenhuys wrote:
On 23/09/13 21:03, silvioprog wrote:
How do I stop the socket before finishing my application?
I've been unsuccessful with that myself, and mentioned it to Michael van
Canneyt. I tried
On 24/09/2013 14:11, Sven Barth wrote:
Am 24.09.2013 13:47, schrieb Reinier Olislagers:
On 24/09/2013 13:13, Sven Barth wrote:
Am 24.09.2013 11:27, schrieb Reinier Olislagers:
On 24/09/2013 11:11, Marco van de Voort wrote:
In our previous episode, Reinier Olislagers said:
Yes, but since the
On Tue, 24 Sep 2013 14:28:42 +0200
Sven Barth pascaldra...@googlemail.com wrote:
Am 24.09.2013 14:17, schrieb Mattias Gaertner:
Hi,
When calling fpc -d foo test.pas there are two mistakes:
First the -d parameter is missing a value, which fpc silently ignores.
And second there are two
On 24/09/2013 14:25, Marco van de Voort wrote:
In our previous episode, Reinier Olislagers said:
snip
Because that has an use. The internal FPC compatability, specially in
the more fringe areas like this, service no use than fattening maillist
archives IMHO.
If you don't see a use for
On Tuesday, September 24, 2013 7:26 AM, Guillermo Martínez
gmarti...@burdjia.com wrote:
Sorry, Philippe, but I can't read your messages. :(
Date: Mon, 23 Sep 2013 10:39:20 -0300
From: Philippe phili...@quarta.com.br
Subject: Re: [fpc-pascal] Re: Problems reading some of the messages
Hi Sven,
2013/9/23 Xiangrong Fang xrf...@gmail.com
Short answer: you can't. The same would happen with normal classes.
Long answer: You could add an additional method Next to your TIntTree
which returns a TIntTree and just do Result := TIntTree(inherited
Next); there.
I still have
I did some google searching which turned up very little so I decided to ask
my question here.
What is the current status of custom RTTI attributes in fpc trunk? Fot
those who don't understand what I am asking about, here is an example.
type
[AttrWithConstructor('Added text value!')]
TRecord
Am 24.09.2013 15:50, schrieb Xiangrong Fang:
Hi Sven,
2013/9/23 Xiangrong Fang xrf...@gmail.com mailto:xrf...@gmail.com
Short answer: you can't. The same would happen with normal
classes.
Long answer: You could add an additional method Next to your
TIntTree
Am 24.09.2013 16:13, schrieb Anthony Walter:
I did some google searching which turned up very little so I decided
to ask my question here.
What is the current status of custom RTTI attributes in fpc trunk? Fot
those who don't understand what I am asking about, here is an example.
They are not
Sven Barth wrote:
does Advanced Record constructor automatically zero all the memory
space of that record?
No, it does not. Neither in Delphi nor in FPC.
Am 24.09.2013 12:36, schrieb Dennis Poon:
if not, is there a clean and easy way to initialize the entire record
memory space to zeros
Am 24.09.2013 16:40, schrieb Dennis Poon:
Sven Barth wrote:
does Advanced Record constructor automatically zero all the memory
space of that record?
No, it does not. Neither in Delphi nor in FPC.
Am 24.09.2013 12:36, schrieb Dennis Poon:
if not, is there a clean and easy way to initialize
2013/9/24 Sven Barth pascaldra...@googlemail.com
How is PNode declared? What is the exact error?
PNode is declared inside TTreap generic class, the source is here:
https://github.com/xrfang/fpcollection/blob/master/src/units/treap.pas
The exact error is:
Error: Incompatible types: got
Am 24.09.2013 17:14, schrieb Xiangrong Fang:
2013/9/24 Sven Barth pascaldra...@googlemail.com
mailto:pascaldra...@googlemail.com
How is PNode declared? What is the exact error?
PNode is declared inside TTreap generic class, the source is here:
Am 24.09.2013 17:32, schrieb Xiangrong Fang:
I know it is same but why no error on the line:
for n in sm1.reversed...
n is of type TStringMapper.PNode whereby PNode is declared inside
TTreapString, String and thus the type is in reality a TTreapString,
String.
sm1.reversed returns a
I know it is same but why no error on the line:
for n in sm1.reversed...
regards.
在 2013-9-24 下午11:23,Sven Barth pascaldra...@googlemail.com写道:
Am 24.09.2013 17:14, schrieb Xiangrong Fang:
2013/9/24 Sven Barth pascaldra...@googlemail.com
How is PNode declared? What is the exact error?
Hi There,
I wonder what is the byte alignment of a NON-packed record? Is it always
4-byte, or 4-byte on 32-bit platform, 8-byte or 64-bit platform?
Regards,
Xiangrong
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
2, according to the docs
--
View this message in context:
http://free-pascal-general.1045716.n5.nabble.com/record-byte-alignment-tp5716788p5716789.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
fpc-pascal maillist -
65 matches
Mail list logo