Compiler allows strange statement

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Compiler allows strange statement

Vincent Snijders-2
Hi,

I looked at
http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/packages/fcl-db/tests/testfieldtypes.pas?r1=13971&r2=13970 
and did not understand the meaning of:
@ASQLQuery.ExecSQL;

To me it seems just a address of a method, not a statement that the compiler can
execute. But the compiler doesn't give an error message.

Also attached sample program compiles without error. Why is there no error on the line:
   @C.Test;

Vincent

program project1;

{$mode objfpc}{$H+}{$X-}

uses
  Classes;

type

  { TMyObject }

  TMyObject = class
  private
    procedure Test;
  end;

{ TMyObject }

procedure TMyObject.Test;
begin

end;

var
  c: TMyObject;
  p: pointer;


begin
  c := TMyObject.Create;
  @C.Test;
  C.Test;
end.


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Compiler allows strange statement

Jonas Maebe-2

On 30 Oct 2009, at 15:38, Vincent Snijders wrote:

> Also attached sample program compiles without error. Why is there no  
> error on the line:
>  @C.Test;

Looks like a compiler bug to me.


Jonas
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Compiler allows strange statement

Vincent Snijders-2
Jonas Maebe schreef:
>
> On 30 Oct 2009, at 15:38, Vincent Snijders wrote:
>
>> Also attached sample program compiles without error. Why is there no
>> error on the line:
>>  @C.Test;
>
> Looks like a compiler bug to me.

I thought so too, thanks for confirming. I reported it:
http://bugs.freepascal.org/view.php?id=14945

Vincent
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Compiling JCL and ULARGE_INTEGER

Bugzilla from juha.manninen@phnet.fi

In my project I include JclCompression unit from jcl 2.01.

Compilation ends with error:

Identifier not found "ULARGE_INTEGER"

in JclBase.pas.

The code defines ULARGE_INTEGER just before the error line, but only if FPC is not defined! Why so? Should ULARGE_INTEGER be defined somewhere in fpc libraries. Didn't find it.

// Redefinition of ULARGE_INTEGER to relieve dependency on Windows.pas

type

{$IFNDEF FPC}

PULARGE_INTEGER = ^ULARGE_INTEGER;

{$EXTERNALSYM PULARGE_INTEGER}

ULARGE_INTEGER = record

case Integer of

0:

(LowPart: LongWord;

HighPart: LongWord);

1:

(QuadPart: Int64);

end;

{$EXTERNALSYM ULARGE_INTEGER}

{$ENDIF ~FPC}

TJclULargeInteger = ULARGE_INTEGER;

PJclULargeInteger = PULARGE_INTEGER;

Juha Manninen


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Compiling JCL

Bugzilla from juha.manninen@phnet.fi
Uhh...
How to compile and build jcl?
Should I try an older version?
Now I have the latest public version jcl-2.01.3449-linux.
I tried to compile the jcl package and got the same ULARGE_INTEGER error.
Then I commented out the {$IFNDEF FPC} in JclBase.pas to let ULARGE_INTEGER be
defined.
Then I get more errors, like
  Error: Identifier not found "MultiByteToWideChar"
  Error: Identifier not found "MB_PRECOMPOSED"
all related to Windows stuff.

What to do? Is this the end of my Lazarus / FPC porting?


Juha Manninen

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Compiling JCL

Marco van de Voort
In our previous episode, Juha Manninen said:

> How to compile and build jcl?
> Should I try an older version?
> Now I have the latest public version jcl-2.01.3449-linux.
> I tried to compile the jcl package and got the same ULARGE_INTEGER error.
> Then I commented out the {$IFNDEF FPC} in JclBase.pas to let ULARGE_INTEGER be
> defined.
> Then I get more errors, like
>   Error: Identifier not found "MultiByteToWideChar"
>   Error: Identifier not found "MB_PRECOMPOSED"
> all related to Windows stuff.
>
> What to do? Is this the end of my Lazarus / FPC porting?

The JCL is not very portable, and worse, non-portable and portable parts are
not very well separated. They have half of the units depending on units that
try to read the borland debug format etc.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Compiling JCL

Bugzilla from juha.manninen@phnet.fi
Hi,

> The JCL is not very portable, and worse, non-portable and portable parts
>  are not very well separated. They have half of the units depending on
>  units that try to read the borland debug format etc.

It is strange because there are conditional compilation IFDEFs for FPC.
Why to include them if the code doesn't compile anyway?
Ugly code I would say. Too many conditionals and dependencies.

I could try to strip JclCompression unit so that only the essence or "real
beaf" is left there. It needs lots of work and feels really stupid and
useless.

How do other people handle this? In some post someone claimed that JCL
compiles somehow under FPC. Well, it doesn't!

Juha Manninen
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Compiling JCL

Graeme Geldenhuys-2
2009/10/31 Juha Manninen <[hidden email]>:
> It is strange because there are conditional compilation IFDEFs for FPC.
> Why to include them if the code doesn't compile anyway?

Just because there are IFDEFs doesn't mean it's complete. It is
probably work in progress, but far from complete by the sounds of
things - I don't really know JCL code.

> Ugly code I would say. Too many conditionals and dependencies.

That's what you get if you don't use a compiler that is designed to be
cross-platform. FPC with RTL, FCL and Lazarus LCL was designed to be
cross-platform so IFDEFs like that are much less required.

I would suggest that if there is something specific you needed from
JCL, then only rip that portion out and port that to FPC - that's if
FPC doesn't already include similar functionality in the FCL.

> I could try to strip JclCompression unit so that only the essence or "real

Which compression algorithm are you looking for. I think I saw
compression algorithm code in FCL before. gzip is definitely there


--
Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Compiling JCL

Bugzilla from juha.manninen@phnet.fi
Hi,

> Which compression algorithm are you looking for. I think I saw
> compression algorithm code in FCL before. gzip is definitely there

I used zlib compression which is the same as gzip I guess.
Then I used also the more efficient bzip2 compression with
TJclBZIP2CompressionStream and TJclBZIP2DeCompressionStream.
I can look for the alternatives elsewhere.

Juha Manninen
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

bzip2 (was: Compiling JCL)

Bugzilla from juha.manninen@phnet.fi
FCL seems to have bzip2 unit but it only has decompression.
Does anyone know of alternatives for bzip2 compression with FPC?

Juha M.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: bzip2

Vincent Snijders-2
Juha Manninen schreef:
> FCL seems to have bzip2 unit but it only has decompression.
> Does anyone know of alternatives for bzip2 compression with FPC?

Please, create a new email message, instead of replying to an existing
one and changing the subject of it.

This message has nothing to do with the "Compiler allows strange
statement" - thread:
http://lists.freepascal.org/lists/fpc-pascal/2009-October/thread.html#22885

Vincent
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: bzip2

Bugzilla from juha.manninen@phnet.fi
> Please, create a new email message, instead of replying to an existing
> one and changing the subject of it.
>
> This message has nothing to do with the "Compiler allows strange
> statement" - thread:
> http://lists.freepascal.org/lists/fpc-pascal/2009-October/thread.html#22885

Oops, sorry. I will do that.
Where does the thread information come from? It looks good in my email client
and I don't see any extra data.

Juha M.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: bzip2

Vincent Snijders-2
Juha Manninen schreef:

>> Please, create a new email message, instead of replying to an existing
>> one and changing the subject of it.
>>
>> This message has nothing to do with the "Compiler allows strange
>> statement" - thread:
>> http://lists.freepascal.org/lists/fpc-pascal/2009-October/thread.html#22885
>
> Oops, sorry. I will do that.
> Where does the thread information come from? It looks good in my email client
> and I don't see any extra data.

Each message gets a id, like:
<[hidden email]>

When you reply to it, this ID is added the reference message header.

Vincent
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: bzip2

Micha Nelissen
In reply to this post by Bugzilla from juha.manninen@phnet.fi
Juha Manninen wrote:
> Oops, sorry. I will do that.
> Where does the thread information come from? It looks good in my email client
> and I don't see any extra data.

Try to enable 'Threaded view'; usually somewhere in the View menu, Sort
menu, etc. Depends on client used.

Micha
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal