[fpc-devel] TProcess empty parameter

Marco van de Voort marcov at stack.nl
Thu May 7 14:15:07 CEST 2015


In our previous episode, Michael Van Canneyt said:
> >
> > Since NIL is a termination of an array of pchar in C that is not ok.
> 
> if that were the case, argc would not have been introduced, 
> which is why I doubt the use of this argument ?

Where is argc on the calling side? In the parameters of ExecVE ? Right.
 
> C code that regards nil as the last element of the argv array is just
> wrong.

IMHO *nix is not terribly well designed. Probably the multitude of versions
and being interwoven with C prohibited doing massive cleanups.
 
> > behaviour of strnew should be checked in both TP and Delphi (since both have
> > strnew) and if necessary changed. (returning FPC_EMPTYCHAR or whatever)

As for Delphi,

uses
  System.SysUtils;

var p : pchar;
begin
  p:=strnew('');
  writeln(assigned(p),' ',ord(p^));
  readln;
end.

writes "TRUE 0"

so it seems to be the emptychar story. Better fix that as well.
Unfortunately, FPC_emptychar is not exported from system.




More information about the fpc-devel mailing list