In
general we try to be Delphi compatible as much as time and
backward compatibility permits.
I hate it if bugs or illogical things are copied from Delphi. It may be the
case that Delphi vanishes one day. Then we still would have all these bugs in
FPC/Lazarus cast in stone forever. I think
function SerRead(Handle: TSerialHandle; var Buffer; Count: LongInt): LongInt;
begin
Result := fpRead(Handle, Buffer, Count);
end;
i don't understand the
declaration for buffer in the function below, because no type is
declared for buffer.
I believe that the type is irrelevant, you
is there actually someone using INDY10 with FPC on other
platforms than windows? version of IINDY, FPC, OS?
If not - is there someone interested in it - or are the alternatives
suiting your needs? If so - what are you using?
I use Ararat Synapse (http://ararat.cz/synapse/doku.php). Works fine
As Marco suggested... Char size might not always be the same.
Why that? I hope noone changes the meaning of such long-time types some
day. If a new type is needed, then it should get a new name too.
___
fpc-pascal maillist -
I would like my program to output the following:
-
Header Section
header.ID(5348h = HS)
...
-
Wouldn't it be more direct to use
Blockwrite(file,header.ID,sizeof(header.ID));
That would make it robust against changes of ID size and would avoid the
many
Is there a way to deal with NaN's and other i387 (and similars)
conventions directly in Pascal ?
Yes, if not yet possible (I didn't have a closer look) I would like to
have that too. But I think it's heavily depending on the processor...
(Details about NaN's and infinity at
A quick study of some language reference docs and a few examples
should be all you need to get started.
The general rules are easy to learn. But to be productive you also need
to know about environments (IDE etc.), available libraries and their
usage (which already differ between Delphi and
Now I know why vendors of newer languages (Dephi, Java etc) are trying
to hide pointers from programmers. They are very tricky to work with -
and give errors without warning!
Especially when compiler and programmer are both trying to outsmart each other.
:D
Yes. But I never needed pointer
There is not even a proper open one for Delphi. At least there wasn't till a
while back.
That may be because it is no longer possible to write a BNF grammar for
these compilers due to the c-style extensions.
___
fpc-pascal maillist -
Sorry, I misread the mail, I thought it was about bitpacked arrays.
Plain packed arrays are no different from regular arrays in FPC (we
basically ignore that modifier, except in MacPas mode where it's an
alias for bitpacked), so the packed monicker can simply be left out
when declaring the
You can post an ad for a C
programmer and get 1,000 applicants, if you post an ad for a Pascal
programmer you might get 5, at least where I live.
Yes, that maybe true. But how has all this started? As far as I know, C
was not that popular in past (at least not on Windows). Instead (Turbo)
Guillermo Martínez Jiménez schrieb:
I really don't understand why Pascal should include C-style stuff.
PASCAL IS DIFFERENT LANGUAGE THAN C. STOP.
I fully agree with all you said but Borland created these Pascal
extensions and now we cannot go back (as others say) because we need
BTW, the expression @DynamicArray should really return the address of the
first element, not the address of the pointer to the array structure.
What's wrong with the current solution?
the first element = DynamicArray[0]
address of the first element - @DynamicArray[0]
You only find this
About pointer arithmetic:
IMO memory is an array. So for me it is quite natural that P^ and P[0]
are the same.
You are missing the point. If you already *know* that you are dealing
with a pointer (to an array), then of course you may use this workaround
(it's nothing else, because if I want
Florian Klaempfl schrieb:
Great power comes with great responsibility.
Yes. Then use C or assembler. You are responsible for everything and
you cannot expect any help from the compiler.
So the consequence would be to forbid pointers/@-operator/type casts et.
al.
No. Only the logic has be
You said C did it wrong, because you think that arrays and pointers
should be different things. That is indeed you opinion, not a fact.
I don't even know why I'm replying any more, it's clearly futile.
Huh? Are you seriously trying to tell us that pointers and arrays are
the same? Ok, then
As said it depends from your viewpoint. C's original viewpoint was to keep
the state of a compilation unit as small as possible, to maximize the size
of a program with limited memory.
You mean they gave saving one character in the source code a higher
priority than having a strict logic in the
And the criticism about introducing Cisms in FPC/Delphi is also old. In the
past I would have joined you, but after a few non-trivial header conversions
and library conversions that pretty much died out.
But why are you then using Pascal at all? I love this language because
of its strict logic
No, it happens with static arrays, if you set pia := @ia, ia[x] and
pia[x] will give you the same result (in delphi mode, at least).
It's simply more readable and a shortcut.
It's definitely the opposite: It is *less* readable because it leaves it
unclear what data you are operating with.
Remember, Pascal is merely a TEACHING language, unsuitable for commercial
software development, which is why we have C. :)
And why should that be the case? What are the outstanding feature of C
that make it so supperiour? It's illogical and hard to maintain syntax?
Or is it just that it was
Yes, it is available everywhere.
And it is easier to copy unix code then.
Remember that it is still not easy to come to freepascal.
You have to configure a debian testing system and apt-get lazarus and so on...
Nearly nowhere the lazarus package is preinstalled.
Yes, these are the reasons for
No, it happens with static arrays, if you set pia := @ia, ia[x] and
pia[x] will give you the same result (in delphi mode, at least).
It's simply more readable and a shortcut.
It's definitely the opposite: It is *less* readable
This is your opinion :) To my experience faking arrays with dyn.
p
The value of a pchar.
What do you mean by value? The pointer or the character it is pointing
to? It seems that p sometimes means the first and sometimes the latter.
p^
the char pointed to.
Is this the same as p?
I don't think you can say anything from pure syntax without bringing
C is popular *even though* it is an awful concept.
It is like the video cassettes.
Betamax and Video2000 were the better quality,
but VHS was the most popular cassette.
Yes, sadly this is true (same with Microsoft pressing one awfull OS
after the other into the market). Not always the best
The beauty of the current solution is that static and dynamic arrays can
be substituted with each other, simple by changing the declaration, and
adding/removing a setlength. All other code can be left as it is.
If you needed the ^ for dyn arrays everywhere, then you would have to
make huge
Its a common mistake to use @dynamic array var instead of @dynamic
array var[ 0 ].
IMO this happens because of an illogical design flaw (which seems to be
introduced by Borland). If I have a variable that is a *pointer* to an
array then why is it possible to use the square brackets to use it
This behaviour comes from C syntax. The array is a pointer, which you
dereference by using the square brackets. This is well defined
syntax, nothing automatic or illogical about it. The only reason
pascal programmers make mistakes with this is because they are less
accustomed to using
I can't understand what you are trying to say. An array is a pointer
to where the elements of the array resides in memory. How else do you
think it works?
just look at:
type ArrayType = array[1..10] of char;
var X : ArrayType;
PX : ^ArrayType
What is the difference between X and
Also, it is very important to make distinction between static and
dynamic arrays. For static arrays, compiler knows their exact memory
location at compile time (modulo situations where static array is part
of another structure), but for dynamic arrays, compiler only knows
where in memory is
2. For the purposes of reserving memory in block sizes that can be
easily reallocated, I like to use powers of two. So if I have, e.g., a
dynamic array, I might start with a size of 1024 and then double it
when it hits capacity. Hopefully this smoothes memory management, as I
am using a lot
Given that the OP was asking about learning, maybe it would be worth
mentioning that the way we normally have data structures which hold
different data these days is by polymorphism in objects or classes.
Instead of having an array of variant records, each of which might hold
a description of a
And I don't know any other Pascal Compiler who does any checks in this
direction. Do some?
I don't know, but ADA reportedly does.
I don't know the differences to Pascal. Does it have the same syntax for
variant records?
Such a feature definitely seems useful to me.
Of course it would
IIRC, there is a difference. With the second declaration the compiler
can add a run-time check that the correct memebrs are accessed based
on the value of X.
Unfortunately, I cannot find the compiler switch.
FPC has no support for this.
And I don't know any other Pascal Compiler who does any
AFAIK there has to be some fixed part before the variant, e. g.
TFigure = record
name: string;
case TShapeList of
Rectangle: (Height, Width: Real);
Triangle: (Side1, Side2, Angle: Real);
Circle: (Radius: Real);
Ellipse, Other: ();
end;
The program could then
Jorge Aldo G. de F. Junior schrieb:
type ifreq = record
ifr_ifrn : record
case longint of
0 : ( ifrn_name : array[0..15] of char );
end;
ifr_ifru : record
case longint of
0 : ( ifru_addr : sockaddr
I have a program that connects to (cisco) network switches with telnet.
It uses Ararat Synapse for the network part. Now some switches were
changed to a secure SSH connection and I wanted to reflect that in my
program. I used Cryplib and all the stuff as mentioned here:
yu ping schrieb:
Lazarus generated exe file size is so large,Can it make small size
program file?
Please look here:
http://wiki.lazarus.freepascal.org/Lazarus_Faq#Why_are_the_generated_binaries_so_big.3F
___
fpc-pascal maillist -
Jürgen Hestermann, how often do you change your working machine?
Well, I seldom change it and I would not even need the Lazarus settings
on other machines because I did not install it on these machines.
But our system works the following (I don't know whether it is specific
to our company
problems
when using roaming profiles (neither losing settings nor performance
impact when copying data on logon).
Jürgen Hestermann.
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Therefore it would be the best of all worlds to save the Lazarus
settings to the Lazarus directory.
No. A sane environment shouldn't even grant you write permissions there.
Then Lazarus should ask where to put the settings on installation
because there are so many different configurations and
IMHO, that is more a problem of your novel setup than of Lazarus.
I don't think so. It's a vaild setup for Windows machines since many
years (see http://www.novell.com/coolsolutions/feature/3136.html). So
why consider all other setups but not this one?
Anyway you know now the trick:
Well, this is happening now, since CSIDL_LOCAL_APPDATA isn't roamed.
Yes. So what's the advantage in using the Lazarus directory instead? ;)
I wouldn't lose my settings on logoff. ;-)
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
I wouldn't lose my settings on logoff. ;-)
Then don't. ;) Usually I just locked the machine overnight.
But as soon as I reboot my machine (for whatever reason and at whatever
day) I lose all my settings. I am not able to configurate anything
different from default because each reboot would
Roaming profiles using auto copy/delete are not the best choice for that.
For me it works fine for years ;)
But not with Larazus, or? That's just the problem that it stores the
settings in parts of the profile that are *not* roamed/copied.
___
Roaming profiles using auto copy/delete are not the best choice for that.
For me it works fine for years ;)
Then you must be the only one since everybody I know despises it.
As I wrote, the company I work for uses this setup for *all* (30,000+)
machines all over the world. And I doubt that
of working which cannot be
achieved with the current temporary block mode.
Thanks in advance for answers.
Jürgen Hestermann.
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Zaher Dirkey schrieb:
use c:\lazarus\Lazarus.exe --pcp=x:\lazarus\config
Thanks for the solution!
Still I am wondering why the directory Local Settings is used and not
Application Data as all other applications do. Then it would be saved
with roaming profiles too.
Martin Friebe schrieb:
Out of curiosity (because I never used this feature in any editor), what
would you use it for?
I used it since Turbo Pascal 5 and found it in all other Pascal IDE's
(even in the text mode IDE of Free Pascal!). And it seems others would
like it too (see
The fact that Borland regarded $FF..FF as a 2's complement
representation and not as a base-16 representation of an integer is
not really what I would call Pascal spirit. As a matter of fact,
Borland mess would be more appropriate. :-)
I always avoid such imponderabilities by using fillchar to
* Free Pascal LGPL -- shortened to FPLGPL
I don't like acronyms, especially if they are more than 3 letters long.
Why not simply name it Free Pascal Licence?
Jürgen Hestermann.
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http
. But now I changed my behaviour
and use VAR declarations directly before the function declaration (one
level higher, outside the function context). That serves the same purpose.
Jürgen Hestermann.
___
fpc-pascal maillist - fpc-pascal
should not be
able to change a constant.
Jürgen Hestermann
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
with NIL is useless. NIL is defined to mean 'not
defined'. How can you add something to that? Even if the compiler allows
you to do that, the result cannot be predicted.
Jürgen Hestermann.
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http
Is that correct:
http://www.delphifaq.com/faq/delphi/windows_file_system/f419.shtml
?
If yes, then you need IFDEFs to distinguish between Linux and Windows. ;-(
Jürgen Hestermann
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http
similar exist in Free-Pascal?
Thanks in advance for any help.
Jürgen Hestermann.
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
in the description of the
EXEC function when it is changed anyway some day. I always wondered
whether the DOS unit can still be used or whether it's just there for
compatibility reasons.
Jürgen Hestermann.
___
fpc-pascal maillist - fpc-pascal
Rainer Stratmann schrieb:
Exists there a simple example for nonblocking client server programming which
can be used in linux and windows?
With fpsocket, fpbind, fpconnect, ...
Rainer
I am not sure whether this could be of use for you:
http://ararat.cz/synapse/doku.php/start
Jürgen
pages that insist
on javascript so it does matter.
Jürgen Hestermann.
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
FillChar(Values,SizeOf(Values),0)
That worked.
However, for an integer is fillword better?
A fillword procedure does not exist. FillChar is an anchient Pascal
function to simply fill any arbitrary memory location of any size
(determined by a variable) with all the same byte. It is very
A fillword procedure does not exist.
It seems I was wrong about this. A fillword procedure DOES exist. I
just discovered this myself. But then the range (size of variable) you
want to fill has to be an even number of bytes. In general this may not
be guaranteed.
Jürgen Hestermann
1K is actually 1024 bytes.
That's not correct. Actually, it was done the wrong all the years and
it's time to clean this up now:
http://de.wikipedia.org/wiki/Bin%C3%A4rpr%C3%A4fix
Of course, the hard disk manufacturers where the first to discover this ;-).
Jürgen Hestermann
1K is actually 1024 bytes.
That's not correct. Actually, it was done the wrong all the years and
it's time to clean this up now:
http://de.wikipedia.org/wiki/Bin%C3%A4rpr%C3%A4fix
Sorry for the german link. Here is an english link:
http://en.wikipedia.org/wiki/Binary_prefix
have to
reliy on sizes:
if sizeof(Word)2then Halt(9000);
if sizeof(DWord)4 then Halt(9001);
if sizeof(LongInt)4 then Halt(9002);
etc.
Then I am at least warned in case my presumption are no longer valid.
Jürgen Hestermann.
___
fpc-pascal
my simple scan program for the creation date of files took
2 days on our server. After removing all the overhead by directly using
FindFirst/FindNext from the windows API it boosted up to 6 hours only.
Sure, many people don't care whether a program runs 2 days or 6 hours
but I do.
Jürgen
times, but internally
there are much more iterations (to check the if d in
[Monday,Wednesday,Friday]).
Jürgen Hestermann.
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
possible
performance issues is quite a bit premature here. ;)
Maybe, but you started talking about performance. ;-)
Jürgen Hestermann.
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
types string (nor
integer) at all. It only leads to confusion because noone knows (or is
aware) of what type is meant in particular. Why not use the strings that
is needed?
Jürgen Hestermann.
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
of coping it to a temporary (local) variable.
Jürgen Hestermann.
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
make any sense. If it's such an error why not raise
an exception instead of silently doing nothing? But it would be better
to just drop malformed characters but not the whole string so a user
would immediately see that something is wrong with the coding.
Jürgen Hestermann
this (as far as I read from the bug
report) for TStrings that are not UTF-8 conform.
Jürgen Hestermann.
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
environment for serious programming if I invest more time in debugging
the LCL than in debugging my own programs.
Jürgen Hestermann.
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
we are talking about the same bug here.
Jürgen Hestermann.
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
that correct?
Yes, of course that's correct. That's the reason I didn't use Unicode
for Lazarus either. But that failed. So I had a hard time to find out
myself that I have to use AnsiToUTF8 for each and every constant string
I use. A quite distracting first contact with Lazarus/FPC.
Jürgen
be more work than I thought and I am not
sure whether it's worth it if I am having even more problems afterwards.
Jürgen Hestermann.
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
confront the programmer with more complexity than needed? Especially
those who start learning programming from scratch realy have a hard time
if such (IMO unnecessary) things are not avoided.
Jürgen Hestermann.
___
fpc-pascal maillist - fpc
be simple: LCL UTF8, RTL Ansi.
Where is this messagebox call defined?
That's the correct question. How do I know which routine is from where?
And why am I forced to think about such things when programming? In
Delphi I am not.
Jürgen Hestermann
entries
LCLIntf, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, LResources;
and the implementation part uses
Windows,FileCtrl,DateUtils,clipbrd,interfaces;
So what am I using and how do I know what I should use?
Jürgen Hestermann
was converted to
Lazarus with the converter, how can it be garbage?
Jürgen Hestermann.
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
AnsiToUTF8.
Without the conversion I would expect to see incorrect characters
instead of the umlauts.
Jürgen Hestermann.
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
ADD and the first
aasignment to Strings[Count-1] is done but all following changes do not
appear. Is this a bug in FP/Lazarus?
Jürgen Hestermann.
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo
if open source becomes
stronger and stronger.
Jürgen Hestermann.
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
not sure whether that's true but it
would explain the behaviour of all Delphi owners.
Jürgen Hestermann.
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
though.
Jürgen Hestermann
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
when the user tests
his programs with simple strings which work and then encounters
the problems late in the project when unusual characters are used.
Better confront the programmer with it right from the start so he
knows what to expect.
Jürgen Hestermann
301 - 384 of 384 matches
Mail list logo