[Info-vax] C... the only winning move is not to play...

VAXman- at SendSpamHere.ORG VAXman- at SendSpamHere.ORG
Mon Feb 10 11:31:36 EST 2014


In article <ldasbs$msg$1 at speranza.aioe.org>, hb <end.of at inter.net> writes:
>On 02/10/2014 03:03 PM, VAXman- @SendSpamHere.ORG wrote:
>> In article <ldahtm$34$1 at reader1.panix.com>, JohnF <john at please.see.sig.for.email.com> writes:
>>> VAXman- wrote:
>> Thanks John.  Here's the KLUDGE written in KLUDGE, errr... C.
>> 
>> #define STR$CONCAT STR$CONCAT_is_badly_prototyped_in_STR$ROUTINES_header
>> #include <str$routines.h>       // OpenVMS STR$ RTL prototype definitions
>> #undef STR$CONCAT
>> #define str$concat STR$CONCAT
>> unsigned int str$concat(struct dsc$descriptor_s*, struct dsc$descriptor_s*, __optional_params);
>
>FWIW, you don't need to #re-define str$concat, it is already defined to
>STR$CONCAT (if it weren't you would get a compiler warning, anyway).
>
>Yes, this works around one problem with the VMS supplied C header files.
>
>On the other hand, struct dsc$descriptor_s is usually only used for a
>"Fixed-Length Descriptor", with suffix "_s" matching the suffix in
>DSC$K_CLASS_S. STR$CONCAT accepts any descriptor, but that can't be
>expressed in a C prototype. That's probably the reason why "they" used
>"void *" rather than "struct dsc$descriptor *". The latter would require
>some casts for the struct dsc$descriptor_d as destination type as well
>as for struct dsc$descriptor_s as source type. But with "void *" it is
>questionable whether there can be useful type checking at all.

Like I said before: Strong typing is for weak minds.

FWIW, I can pass dynamic strings as well as static strings when the args
are define 'struct dsc$descriptor_s *".  The compiler is not so congenial
when I define it just 'struct dsc$descriptor *' despite the fact that the
dsc$descriptor, dsc$descriptor_s and dsc$descriptor_d all look the same.
The C compiler doesn't see the dsc$b_class or dsc$b_dtype values.  There
should be a way to provide for this but then... same old song... 

-- 
VAXman- A Bored Certified VMS Kernel Mode Hacker    VAXman(at)TMESIS(dot)ORG

Well I speak to machines with the voice of humanity.



More information about the Info-vax mailing list