[fpc-pascal] h2pas and implicit types
JeLlyFish.software at gmx.net
Fri Sep 8 20:19:05 CEST 2006
Mattias Gaertner wrote:
> I'm currently working on a h2pas gui for lazarus.
> h2pas does not translate every c 'sugar'.
> 1. Example
> #define MPI_ARGV_NULL (char **)0
> One translation could be:
> const MPI_ARGV_NULL: PPChar = nil;
MPI_ARGV_NULL = NIL;
> What is the best way to handle this?
Usually I'd suggest shooting the programmer who writes such idiocy, but
I guess that's not an option here. :->
> 2. Example
> #define MPI_ARGVS_NULL (char ***)0
> This needs a new type PPPChar.
No. This is (usually pre-ISO-C) nonsense to create a "typed" NULL pointer.
Solution is the same as above. C's NULL pointer is compatible to all
pointer types, just like NIL in Pascal, so there's no need to define
such stupid macros.
It's probably based on the same stupid idea to write stuff like
"(char*)malloc(...)" instead of including the correct header files.
More information about the fpc-pascal