[Info-vax] C... the only winning move is not to play...
hb
end.of at inter.net
Mon Feb 10 10:48:15 EST 2014
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.
More information about the Info-vax
mailing list