(j3.2006) Get_Command_Argument
Malcolm Cohen
malcolm
Thu Dec 15 20:54:13 EST 2011
>I have a character string that needs to be sent to a C function.
>
>I get it from the command line, using Get_Command_Argument.
>
>Since I need to send it to a C function, it has to be kind C_Char. This
>leads to two choices:
>
>1. Cross my fingers and hope C_Char is the same as default kind.
Will work for the time being, but...
>2. Copy the string from the command line to the one that gets sent to
>the C function.
You probably want to do that anyway to put the null char on the end. That would
seem to be the appropriate time to do whatever conversions are necessary.
>Which leads back to the largely-ignored original question:
Not ignored, you just didn't like the answer!
>Would it be unreasonable to allow C_Kind for the character arguments of
>Get_Command_Argument and Get_Environment_Variable?
No, that was not your question (you asked *should* we do that), but whatever.
Whatever conversion it is that you want it to do automatically, I'm sure that
others would want a different one. You should write the conversion you want -
for example, non-ASCII characters might well be considered an error for some
applications.
As I wrote earlier:
"There certainly is some work we could do to regularise and extend our
character set coverage, but pretending that everything now and in the future can
and will be done in 8-bit C chars would be a step backwards, not forwards."
Cheers,
--
................................Malcolm Cohen, Nihon NAG, Tokyo.
More information about the J3
mailing list