Re: [fpc-devel] {$I %LINE%} and friends

2011-04-29 Thread michael . vancanneyt



On Fri, 29 Apr 2011, Joerg Schuelke wrote:


There is one problem with {$I %LINE%} and his friends, which restricts
the use of these directives. They are expanded even inside a macro
immediately, so, if you define a macro for debugging purposes, you
get the line and file info for the place of the definition and not
for the place of the expansion.

I am playing around with the compiler for some weeks, maybe i will send
a patch ( in a couple of weeks, the code is somehow complicated ) if
desired.

But what is the cleaner way? To defer the expansion of {$I %xxx%}
inside macros, or to define c-like macros __LINE__ and __FILE__, maybe
with nicer names?


Defer expansion. 
The use of {$I } is mandatory, since __LINE__ and friends are valid

pascal identifiers and this should not be changed by a macro.

Michael.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] {$I %LINE%} and friends

2011-04-29 Thread Hans-Peter Diettrich

michael.vancann...@wisa.be schrieb:


But what is the cleaner way? To defer the expansion of {$I %xxx%}
inside macros, or to define c-like macros __LINE__ and __FILE__, maybe
with nicer names?


Defer expansion. The use of {$I } is mandatory, since __LINE__ and 
friends are valid

pascal identifiers and this should not be changed by a macro.


What about %%LINE%%, or {%LINE%} or {{LINE}}?

I wonder why FPC broke Delphi compatibility by adding {$MODE}, instead 
of choosing its own prefix for added compiler directives and macros.


DoDi

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] {$I %LINE%} and friends

2011-04-29 Thread michael . vancanneyt



On Fri, 29 Apr 2011, Hans-Peter Diettrich wrote:


michael.vancann...@wisa.be schrieb:


But what is the cleaner way? To defer the expansion of {$I %xxx%}
inside macros, or to define c-like macros __LINE__ and __FILE__, maybe
with nicer names?


Defer expansion. The use of {$I } is mandatory, since __LINE__ and friends 
are valid

pascal identifiers and this should not be changed by a macro.


What about %%LINE%%, or {%LINE%} or {{LINE}}?


Keep it simple; the less directives, the better.

I wonder why FPC broke Delphi compatibility by adding {$MODE}, instead of 
choosing its own prefix for added compiler directives and macros.


Because it would mean yet another kind of directive, this is confusing.

Michael.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] {$I %LINE%} and friends

2011-04-29 Thread Marco van de Voort
In our previous episode, Hans-Peter Diettrich said:
 I wonder why FPC broke Delphi compatibility by adding {$MODE}, instead 
 of choosing its own prefix for added compiler directives and macros.

FPC might not have been that Delphi compatible when this was introduced. 

IIRC mode FPC is the oldest, then the mode concept was developed because of
some extremely unportable TP features, like the 16-bit array
indexing wrap, absolute with 16-bit addresses? Specially the former could
also impact performance (inserted instructions on every array access)

Then ObjFPC evolved, and only then Delphi.

In the beginning the idea was to have an totally own oo dialect, but the
number of people that worked on it continuously was low and they did burn
out fast leaving half finished stuff. 

Btw selecting own prefixes is dangerous. Most logical ones have been in use
for some external macro or documentation system sooner or later, or some or
the other compiler reacts to them.  (e.g.   is used by VP iirc)

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] {$I %LINE%} and friends

2011-04-29 Thread Daniël Mantione



Op Fri, 29 Apr 2011, schreef michael.vancann...@wisa.be:

I wonder why FPC broke Delphi compatibility by adding {$MODE}, instead of 
choosing its own prefix for added compiler directives and macros.


Because it would mean yet another kind of directive, this is confusing.


My take on it is that if Delphi aborts on it, that is a Delphi problem. A 
compiler should warn, not abort, at a unknown directive.


Daniël___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] {$I %LINE%} and friends

2011-04-29 Thread Marco van de Voort
In our previous episode, Dani?l Mantione said:
  I wonder why FPC broke Delphi compatibility by adding {$MODE}, instead of 
  choosing its own prefix for added compiler directives and macros.
 
  Because it would mean yet another kind of directive, this is confusing.
 
 My take on it is that if Delphi aborts on it, that is a Delphi problem. A 
 compiler should warn, not abort, at a unknown directive.

The question is not if that is Delphi's problem, but how you are going to
make it their problem and fix it :-)
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] {$I %LINE%} and friends

2011-04-29 Thread Florian Klaempfl

Am 29.04.2011 10:59, schrieb Hans-Peter Diettrich:

michael.vancann...@wisa.be schrieb:


But what is the cleaner way? To defer the expansion of {$I %xxx%}
inside macros, or to define c-like macros __LINE__ and __FILE__, maybe
with nicer names?


Defer expansion. The use of {$I } is mandatory, since __LINE__ and
friends are valid
pascal identifiers and this should not be changed by a macro.


What about %%LINE%%, or {%LINE%} or {{LINE}}?

I wonder why FPC broke Delphi compatibility by adding {$MODE}, instead
of choosing its own prefix for added compiler directives and macros.


I think an explicit {$ifdef FPC} is much more readable and everybody 
knows what's meant.

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] {$I %LINE%} and friends

2011-04-28 Thread Joerg Schuelke
There is one problem with {$I %LINE%} and his friends, which restricts
the use of these directives. They are expanded even inside a macro
immediately, so, if you define a macro for debugging purposes, you
get the line and file info for the place of the definition and not
for the place of the expansion.

I am playing around with the compiler for some weeks, maybe i will send
a patch ( in a couple of weeks, the code is somehow complicated ) if
desired.

But what is the cleaner way? To defer the expansion of {$I %xxx%}
inside macros, or to define c-like macros __LINE__ and __FILE__, maybe
with nicer names?

Best regards
Jörg
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel