Hi! Jeff Tranter wrote:
Based on previous experiences with another Pascal system, one of the most useful features was run-time checking (array bounds, sub-ranges, enumerated types, etc.). [...] I'm wondering: 1. Would people find this a useful feature for GNU Pascal?
Yes.
2. Would it be feasible to implement it in the compiler?
It is planned for after 2.1. See the GPC TODO list, http://fjf.gnu.de/gpc-todo_toc.html, for details. If you want to help us implementing it, be welcome. :)
It could also be selectively be turned off for efficiency.
Yes, of course: With BP-compatible (*$R+*) or (*$R-*), command-line options --[no-]range-checking and associated compiler directives (*$[no-]range-checking *)
GNU Pascal converts the case-insensitive Pascal identifiers to symbols that are lower-case with the first letter capitalized. [...] 1 Make Pascal case sensitive (probably not an option since it would presumably not match the language spec)
This is not an option indeed.
2. Convert Pascal symnbols to all lowercase. You could then call C routines if they were all lowercase (which is the most common).
This would cause a lot of name clashes with C library functions. For instance, a user program would not be allowed to declare a procedure `puts'.
3. Have some extension to indicate C linkage (like C++ and some C compilers do). Maybe an extension or alternative to the EXTERNAL keyword.
This already exists. See `info -f gpc -n "Other languages"'. Procedure Foo; C; (* extern void foo ( void ); *) Procedure FooBar; asmname 'FooBar'; (* extern void FooBar ( void ); *)
Note, a side effect of capitalizing all identifiers in the lexical analyzer is that currently the compiler may report an error such as
foo.pas:1: parse error before `Error'
when the source code actually used the string 'ERROR'.
I already thought of storing the first occurrence of a Pascal identifier for such messages, but right now I think that we have more important things to do. Thanks for your input, Peter -- Peter Gerwinski, Essen, Germany, http://home.pages.de/~Peter.Gerwinski/ Maintainer GNU Pascal - http://home.pages.de/~GNU-Pascal/ - gpc-19990118 PGP key on request - 6C 94 45 BE 28 A4 96 - 0E CC E9 12 47 25 82 75 *** Vote against SPAM! ********* http://www.politik-digital.de/spam/ ***