[Search for users]
[Overall Top Noters]
[List of all Conferences]
[Download this site]
Title: | DECC |
Notice: | General DEC C discussions |
Moderator: | TLE::D_SMITH N TE |
|
Created: | Fri Nov 13 1992 |
Last Modified: | Fri Jun 06 1997 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 2212 |
Total number of notes: | 11045 |
2140.0. "accept - prototype has changed" by CSC32::J_HENSON (Don't get even, get ahead!) Mon Apr 07 1997 14:31
dec c v5.5-002, openvms V6.2, alpha, ucx v4.1 eco 4
I know that this is probably a VMS issue, but I've always had good luck
starting off here so I'll try it again.
The prototype for the socket interface routine accept has changed. In
particular, the third argument, address length, is now defined as
a pointer to unsigned int (unsigned int *).
The documentation still defines it as a pointer to int, and previous
versions of c/ucx prototype it that way.
The command procedure listed at the bottom of this message can be
used to demonstrate the change.
Was this change intentional, or one of those things that fell through
the cracks? If intentional, when will the documentation be updated?
Also, are there any special defines or qualifiers that one can use
to get the old prototype?
Thanks,
Jerry
P.S. I know that the code below has errors in it. I only intend
to show the prototype problem with this. When you compile this,
it fails with a %cc-e-ptrmismat error.
=====================================================================
$create socket.c
#include <socket.h>
main()
{
int socket,addrlen,stat;
struct sockaddr addr;
stat = accept(socket,&addr,&addrlen);
}
$cc socket
T.R | Title | User | Personal Name | Date | Lines |
---|
2140.1 | | SPECXN::DERAMO | Dan D'Eramo | Mon Apr 07 1997 14:53 | 34 |
| Compiling with /define="_DECC_V4_SOURCE" tells the header file
to prototype it the old way. And remember that...
When more than one /DEFINE is present on the CC command line or in
a single compilation unit, only the last /DEFINE is used.
When both /DEFINE and /UNDEFINE are present in a command line,
/DEFINE is evaluated before /UNDEFINE.
...so merge it into any existing /define=(...), don't just
append it at the end of the compiler command line.
You probably need to look up _DECC_V4_SOURCE in the index of
the run-time library reference to see where it is documented.
Dan
SPECXN $ type y.c
#include <socket.h>
SPECXN $ cc/decc/prep=y1.i/noobject y.c
SPECXN $ cc/decc/prep=y2.i/noobject/define="_DECC_V4_SOURCE" y.c
SPECXN $ search y%.i accept
******************************
USER8:[DERAMO]Y1.I;1
int accept (int __sd, struct sockaddr *__S_addr, __size_t *__len);
******************************
USER8:[DERAMO]Y2.I;1
int accept (int __sd, struct sockaddr *__S_addr, int *__addrlen);
SPECXN $
|
2140.2 | thanks, and... | CSC32::J_HENSON | Don't get even, get ahead! | Tue Apr 08 1997 10:52 | 13 |
| >> <<< Note 2140.1 by SPECXN::DERAMO "Dan D'Eramo" >>>
>> Compiling with /define="_DECC_V4_SOURCE" tells the header file
>> to prototype it the old way. And remember that...
Thanks for the workaround, Dan.
Now, what about the issue of getting this corrected? Should I qar
this in one of the OpenVMS databases?
Thanks,
Jerry
|
2140.3 | | SPECXN::DERAMO | Dan D'Eramo | Tue Apr 08 1997 12:26 | 18 |
| >Now, what about the issue of getting this corrected? Should I qar
>this in one of the OpenVMS databases?
Documentation QAR's can be done from CHAMP or by email to
[email protected] (CASDOC::DECC_DOCS). Suggest
that Appendix A on socket routines also mention this [quoted
from Section 1.5.5 of the Nov. 1995 DEC C Run-Time Library
Reference Manual for OpenVMS Systems]
To conform to standards, some changes are source-code
incompatible but binary compatible. To select DEC C
Version V4.0 source compatibility, use the _DECC_V4_SOURCE
macro.
A mention of /WARNINGS=(DISABLE=(PTRMISMATCH)) might also
help.
Dan
|
2140.4 | | TLE::WHITMAN | | Tue Apr 08 1997 18:07 | 21 |
| Jerry,
The DEC C RTL documentation should be changed to indicate that
accept
bind
connect
getpeername
getsockname
recvfrom
sendto
have two possible prototypes in socket.h. The default, changed in DEC C
in V5.2, follows the X/Open specification and treats length values
as size_t types. The prototype supplied for compatibility
treats lengths as int or int* types. Both these prototypes
and the use of each should be documented.
I will post this in crtl_internal to make sure that this gets
corrected. Thanks for pointing it out.
|
2140.5 | Thanks | CSC32::J_HENSON | Don't get even, get ahead! | Wed Apr 09 1997 10:23 | 0
|