SDL and GNU Pascal

Frank Heckenbach ih8mj at fjf.gnu.de
Wed Nov 1 20:29:45 CET 2006


Florian Klaempfl wrote:

> Frank Heckenbach schrieb:
> > We've discussed this, but using the capitalization from the Pascal
> > identifier would, unfortunately, be wrong because Pascal by
> > definition is case-insensitive, i.e.
> > 
> >   procedure Foo; external;
> > 
> > and
> > 
> >   procedure foo; external;
> > 
> > are equivalent, i.e. must yield the same result. Of course, FPC
> > doesn't care about standard Pascal, but GPC does (and also applies
> > them, as much as reasonable, to non-standard extensions such as
> > "external").
> 
> external is something to interface to external libraries which aren't 
> necessarily written in pascal so we've to give up some pascal principles 
> here when deriving the external name of the procedure :) BTW: Where is 
> it written in any standard that you always lower case identifiers 
> internally? FPC uppercases by default everything internally.

This is not written in the standard. It just says that both forms
are equivalent. We could just have a different convention (and in
fact, we did until some time ago, when the first character was
capitalized, and the rest lower-cased), as long as it's
case-insensitive, as far as Pascal identifiers are concerned (as
Andreas already pointed out, the explicit name specifications are
syntactically string constants, and thus case-sensitive).

We now choose all-lowercase rather arbitrarily (all-uppercase would
work just as well), perhaps just for some kind of consistency with
default unit file names (i.e., in absence of an "in 'foo.pas'"
specification), which is also derived from the unit name,
lower-cased, for more practical reasons (on case-sensitive file
systems, lower-case file names are much more common and easier to
type; on others, it doesn't matter).

> >   procedure Foo; external;
> >
> > and
> >
> >   procedure foo; external;
> >
> > are equivalent, i.e. must yield the same result. Of course, FPC
> > doesn't care about standard Pascal
> 
> The above is also equivalent in FPC. Only if additionally "cdecl" (or  
> C in MacPas) is added, then the capitalization of the identifier is  
> kept for obvious reasons.

"Obvious" is, of course, only your opinion. I find it obvious, that
in a case-insensitive language, programs that differ only in the
case of an identifier must yield the same result.

(I may add that GPC has an optional warning for differing identifier
case, but this doesn't change the statement. If the program compiles
at all, i.e. one does not enable this warning and abort on warnings
("-Werror"), the resulting program is the same.)

Frank

-- 
Frank Heckenbach, f.heckenbach at fh-soft.de, http://fjf.gnu.de/, 7977168E
GPC To-Do list, latest features, fixed bugs:
http://www.gnu-pascal.de/todo.html
GPC download signing key: ACB3 79B2 7EB2 B7A7 EFDE  D101 CD02 4C9D 0FE0 E5E8





More information about the Gpc mailing list