From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <3096bd910604162350j7be64566i5478c547558bd9da@mail.gmail.com> Date: Mon, 17 Apr 2006 08:50:21 +0200 From: "Rodolfo (kix)" To: "Fans of the OS Plan 9 from Bell Labs" <9fans@cse.psu.edu> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_21733_24997937.1145256621608" Subject: [9fans] Function args not checked Topicbox-Message-UUID: 37b8c3cc-ead1-11e9-9d60-3106f5b1d025 ------=_Part_21733_24997937.1145256621608 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi, I have this definitions: extern Elem mkoid(Ints *oid); // asn1.h Ints * snmp_mkoid(char *str); // snmp_asn1.h char * oids[MAX]; and, this: myElem =3D mkoid(snmp_mkoid(oids[0])); The 8c returns: x.c:216 function args not checked: snmp_mkoid x.c:216 argument prototype mismatch "INT" for "IND STRUCT Ints": mkoid why? -- Rodolfo Garc=EDa "kix" ------=_Part_21733_24997937.1145256621608 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi,

I have this definitions:

extern Elem mkoid(Ints *oid); //= asn1.h
Ints * snmp_mkoid(char *str); // snmp_asn1.h
char * oids[MAX]= ;

and, this:

myElem =3D mkoid(snmp_mkoid(oids[0])); 
The 8c returns:

x.c:216 function args not checked: snmp_mkoid
x.c= :216 argument prototype mismatch "INT" for "IND STRUCT Ints&= quot;: mkoid

why?

--
Rodolfo Garc=EDa "= ;kix" ------=_Part_21733_24997937.1145256621608-- From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: To: 9fans@cse.psu.edu Subject: Re: [9fans] Function args not checked Date: Mon, 17 Apr 2006 00:00:40 -0700 From: geoff@collyer.net In-Reply-To: <3096bd910604162350j7be64566i5478c547558bd9da@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: 37bc84e4-ead1-11e9-9d60-3106f5b1d025 It sounds like the header that declares snmp_mkoid isn't being included in the file that contains myElem = mkoid(snmp_mkoid(oids[0])); From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <3096bd910604170025k293728a0y6b66929a726be6fd@mail.gmail.com> Date: Mon, 17 Apr 2006 09:25:29 +0200 From: "Rodolfo (kix)" To: "Fans of the OS Plan 9 from Bell Labs" <9fans@cse.psu.edu> Subject: Re: [9fans] Function args not checked In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_22057_5512857.1145258729660" References: <3096bd910604162350j7be64566i5478c547558bd9da@mail.gmail.com> Topicbox-Message-UUID: 37cd9798-ead1-11e9-9d60-3106f5b1d025 ------=_Part_22057_5512857.1145258729660 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Yes! thanks On 4/17/06, geoff@collyer.net wrote: > > It sounds like the header that declares snmp_mkoid isn't being > included in the file that contains > > myElem =3D mkoid(snmp_mkoid(oids[0])); > > -- Rodolfo Garc=EDa "kix" ------=_Part_22057_5512857.1145258729660 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Yes!

thanks



--
Rodolfo Garc=EDa "kix" ------=_Part_22057_5512857.1145258729660-- From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <40e76fd4ab1b047841b5829ed8015b0e@plan9.bell-labs.com> Date: Mon, 17 Apr 2006 10:52:36 -0400 From: jmk@plan9.bell-labs.com To: 9fans@cse.psu.edu Subject: Re: [9fans] Function args not checked In-Reply-To: <3096bd910604162350j7be64566i5478c547558bd9da@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Topicbox-Message-UUID: 37d9dc88-ead1-11e9-9d60-3106f5b1d025 As an aside, when you declare prototypes I find it is best to only give the types of the parameters and not declare identifiers, e.g. extern Elem mkoid(Ints *); // asn1.h rather than extern Elem mkoid(Ints *oid); // asn1.h This prevents confusion in environments where there is overuse of the pre-processor and the identifier gets substituted. --jim On Mon Apr 17 02:51:00 EDT 2006, rodolfogarciap@gmail.com wrote: >=20 > Hi, >=20 > I have this definitions: >=20 > extern Elem mkoid(Ints *oid); // asn1.h > Ints * snmp_mkoid(char *str); // snmp_asn1.h > char * oids[MAX]; >=20 > and, this: >=20 > myElem =3D mkoid(snmp_mkoid(oids[0])); >=20 > The 8c returns: >=20 > x.c:216 function args not checked: snmp_mkoid > x.c:216 argument prototype mismatch "INT" for "IND STRUCT Ints": mkoid >=20 > why? >=20 > -- > Rodolfo Garc=C3=ADa "kix" >=20 From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <4443B191.1000703@asgaard.homelinux.org> Date: Mon, 17 Apr 2006 17:17:37 +0200 From: =?UTF-8?B?Ik5pbHMgTy4gU2Vsw6VzZGFsIg==?= User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> Subject: Re: [9fans] Function args not checked References: <40e76fd4ab1b047841b5829ed8015b0e@plan9.bell-labs.com> In-Reply-To: <40e76fd4ab1b047841b5829ed8015b0e@plan9.bell-labs.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: 37ddc898-ead1-11e9-9d60-3106f5b1d025 jmk@plan9.bell-labs.com wrote: > As an aside, when you declare prototypes I find it is best to > only give the types of the parameters and not declare identifiers, > e.g. > extern Elem mkoid(Ints *); // asn1.h > rather than > extern Elem mkoid(Ints *oid); // asn1.h > This prevents confusion in environments where there is overuse > of the pre-processor and the identifier gets substituted. Valid point,but I find the names quite helpful and of documentary value - perhaps it's a defect of mine after reading too much non-obvious code. From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <3e1162e60604170828y1d46b4c6xc77064b88aa5c16@mail.gmail.com> Date: Mon, 17 Apr 2006 08:28:48 -0700 From: "David Leimbach" To: "Fans of the OS Plan 9 from Bell Labs" <9fans@cse.psu.edu> Subject: Re: [9fans] Function args not checked In-Reply-To: <4443B191.1000703@asgaard.homelinux.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <40e76fd4ab1b047841b5829ed8015b0e@plan9.bell-labs.com> <4443B191.1000703@asgaard.homelinux.org> Topicbox-Message-UUID: 37e4a528-ead1-11e9-9d60-3106f5b1d025 On 4/17/06, "Nils O. Sel=E5sdal" wrote: > jmk@plan9.bell-labs.com wrote: > > As an aside, when you declare prototypes I find it is best to > > only give the types of the parameters and not declare identifiers, > > e.g. > > extern Elem mkoid(Ints *); // asn1.h > > rather than > > extern Elem mkoid(Ints *oid); // asn1.h > > This prevents confusion in environments where there is overuse > > of the pre-processor and the identifier gets substituted. > > Valid point,but I find the names quite helpful and of documentary > value - perhaps it's a defect of mine after reading too much > non-obvious code. > Well a lot of people fall back to header files for documentation purposes, and looking headers to figure out which of the "char *'s" is a source and which is a destination in some cases is nice. Nothing that can't be solved with good comments and man pages though. From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <7744762da5d6e3361b0d1f3af6b3bd45@plan9.bell-labs.com> Date: Mon, 17 Apr 2006 11:31:42 -0400 From: jmk@plan9.bell-labs.com To: 9fans@cse.psu.edu Subject: Re: [9fans] Function args not checked In-Reply-To: <3e1162e60604170828y1d46b4c6xc77064b88aa5c16@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Topicbox-Message-UUID: 37ed96ba-ead1-11e9-9d60-3106f5b1d025 Prototypes are not documentation. On Mon Apr 17 11:29:34 EDT 2006, leimy2k@gmail.com wrote: > On 4/17/06, "Nils O. Sel=C3=A5sdal" wr= ote: > > jmk@plan9.bell-labs.com wrote: > > > As an aside, when you declare prototypes I find it is best to > > > only give the types of the parameters and not declare identifiers, > > > e.g. > > > extern Elem mkoid(Ints *); // asn1.h > > > rather than > > > extern Elem mkoid(Ints *oid); // asn1.h > > > This prevents confusion in environments where there is overuse > > > of the pre-processor and the identifier gets substituted. > > > > Valid point,but I find the names quite helpful and of documentary > > value - perhaps it's a defect of mine after reading too much > > non-obvious code. > > >=20 > Well a lot of people fall back to header files for documentation > purposes, and looking headers to figure out which of the "char *'s" is > a source and which is a destination in some cases is nice. >=20 > Nothing that can't be solved with good comments and man pages though. From mboxrd@z Thu Jan 1 00:00:00 1970 Mime-Version: 1.0 (Apple Message framework v746.2) In-Reply-To: <7744762da5d6e3361b0d1f3af6b3bd45@plan9.bell-labs.com> References: <7744762da5d6e3361b0d1f3af6b3bd45@plan9.bell-labs.com> Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed Message-Id: <00E03F87-8A6C-4DA6-8E7D-1800D4D27157@telus.net> Content-Transfer-Encoding: quoted-printable From: Paul Lalonde Subject: Re: [9fans] Function args not checked Date: Mon, 17 Apr 2006 08:40:51 -0700 To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> Topicbox-Message-UUID: 37f2bff0-ead1-11e9-9d60-3106f5b1d025 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 17-Apr-06, at 8:31 AM, jmk@plan9.bell-labs.com wrote: > Prototypes are not documentation. Absolutely. But they have a better chance of reflecting reality. Not everyone is blessed to work on good code bases. Until then, I'll =20= keep "documenting" my prototypes with good names. Paul > > On Mon Apr 17 11:29:34 EDT 2006, leimy2k@gmail.com wrote: >> On 4/17/06, "Nils O. Sel=E5sdal" =20 >> wrote: >>> jmk@plan9.bell-labs.com wrote: >>>> As an aside, when you declare prototypes I find it is best to >>>> only give the types of the parameters and not declare identifiers, >>>> e.g. >>>> extern Elem mkoid(Ints *); // asn1.h >>>> rather than >>>> extern Elem mkoid(Ints *oid); // asn1.h >>>> This prevents confusion in environments where there is overuse >>>> of the pre-processor and the identifier gets substituted. >>> >>> Valid point,but I find the names quite helpful and of documentary >>> value - perhaps it's a defect of mine after reading too much >>> non-obvious code. >>> >> >> Well a lot of people fall back to header files for documentation >> purposes, and looking headers to figure out which of the "char =20 >> *'s" is >> a source and which is a destination in some cases is nice. >> >> Nothing that can't be solved with good comments and man pages though. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (Darwin) iD8DBQFEQ7cEpJeHo/Fbu1wRAnhfAKDFwmHNnIaZgveun50Tkqq43OuSBwCgmp6C +HRZ02LcjezPFri/8RrkuP0=3D =3Deds8 -----END PGP SIGNATURE----- From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <4443BA0C.3020300@comtv.ru> Date: Mon, 17 Apr 2006 19:53:48 +0400 From: Victor Nazarov User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) MIME-Version: 1.0 To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> Subject: Re: [9fans] Function args not checked References: <40e76fd4ab1b047841b5829ed8015b0e@plan9.bell-labs.com> In-Reply-To: <40e76fd4ab1b047841b5829ed8015b0e@plan9.bell-labs.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: 3814cb36-ead1-11e9-9d60-3106f5b1d025 jmk@plan9.bell-labs.com wrote: >As an aside, when you declare prototypes I find it is best to >only give the types of the parameters and not declare identifiers, >e.g. > extern Elem mkoid(Ints *); // asn1.h >rather than > extern Elem mkoid(Ints *oid); // asn1.h >This prevents confusion in environments where there is overuse >of the pre-processor and the identifier gets substituted. > > It's just an evidence of preprocessor's danger. Let's use enums. IMHO, prototypes are quite good documentation sometimes. -- Victor Nazarov From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <9ab217670604170900o62544233r59b8a9a504a656f6@mail.gmail.com> Date: Mon, 17 Apr 2006 09:00:33 -0700 From: "Devon H. O'Dell" To: "Fans of the OS Plan 9 from Bell Labs" <9fans@cse.psu.edu> Subject: Re: [9fans] Function args not checked In-Reply-To: <4443BA0C.3020300@comtv.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <40e76fd4ab1b047841b5829ed8015b0e@plan9.bell-labs.com> <4443BA0C.3020300@comtv.ru> Topicbox-Message-UUID: 3822cc7c-ead1-11e9-9d60-3106f5b1d025 2006/4/17, Victor Nazarov : > jmk@plan9.bell-labs.com wrote: > > >As an aside, when you declare prototypes I find it is best to > >only give the types of the parameters and not declare identifiers, > >e.g. > > extern Elem mkoid(Ints *); // asn1.h > >rather than > > extern Elem mkoid(Ints *oid); // asn1.h > >This prevents confusion in environments where there is overuse > >of the pre-processor and the identifier gets substituted. > > > > > It's just an evidence of preprocessor's danger. Let's use enums. IMHO, > prototypes are quite good documentation sometimes. Until someone reorders arguments and forgets to update the prototype to reflect them. Using argument names in your prototypes is not an excuse to not write documentation on your API. It is an excuse to be lazy. --Devon > -- > Victor Nazarov > > From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <536d93713f9b4b3342371dc409ee1545@9netics.com> To: 9fans@cse.psu.edu Subject: Re: [9fans] Function args not checked Date: Mon, 17 Apr 2006 09:30:00 -0700 From: Skip Tavakkolian <9nut@9netics.com> In-Reply-To: <00E03F87-8A6C-4DA6-8E7D-1800D4D27157@telus.net> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: 382e5452-ead1-11e9-9d60-3106f5b1d025 >> Prototypes are not documentation. > > Absolutely. But they have a better chance of reflecting reality. > > Not everyone is blessed to work on good code bases. Until then, I'll > keep "documenting" my prototypes with good names. variable naming conventions are not enforced by the compiler; they could be misleading. why not use an ide - e.g. eclipse is available for many platforms - or just document the code. using cweb will exhibit your STRONG commitment to good documentation :) From mboxrd@z Thu Jan 1 00:00:00 1970 Mime-Version: 1.0 (Apple Message framework v623) In-Reply-To: <536d93713f9b4b3342371dc409ee1545@9netics.com> References: <536d93713f9b4b3342371dc409ee1545@9netics.com> Content-Type: text/plain; charset=US-ASCII; format=fixed Message-Id: <3b9009a1d7e95196538ff9a7b2e8e7fe@gmail.com> Content-Transfer-Encoding: 7bit From: Don Bailey Subject: Re: [9fans] Function args not checked Date: Mon, 17 Apr 2006 14:43:13 -0600 To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> Topicbox-Message-UUID: 3899b5da-ead1-11e9-9d60-3106f5b1d025 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > variable naming conventions are not enforced by the compiler; they > could be misleading. why not use an ide - e.g. eclipse is available > for many platforms - or just document the code. using cweb will > exhibit your STRONG commitment to good documentation :) > I used to have a problem deciding how to keep track of IN and OUT arguments in functions. Rather than bothering to clutter up prototypes with names, I came up with this simple technique: for anyfunction(IN * A, IN * B, IN * C, OUT * A) Variables used as input to the given function will be sent first, in alphabetical order by type. Output variables will be sent next, alphabetically by type. Thus, str->dup(char *, char ** ); Even without the second indirection giving us an obvious clue, we know that the first variable is input and the second is output. Because I stick to this as a strict part of my API, I never have to check the source to remind myself what I'm doing. Just thought I'd give my two cents. Don "north" Bailey -----BEGIN PGP SIGNATURE----- Version: PGP Desktop 9.0.6 (Build 6060) iQA/AwUBREP94V/Ie1ANMtLuEQIVtQCfVWiWpqI6Tm0/mhhGFYGw82vPdJMAn24k t6Kdoj1SWPR9iuSEGOc1/NGd =6JoQ -----END PGP SIGNATURE-----