On Fri, Feb 18, 2005 at 12:39:18PM +0000, Bryan O'Donoghue wrote:
>> But don't you chaps typecheck ?
Yep, but I know C :) In C, if you don't explicitly set return
types, or argument types two things happen. Firstly int is
the default type. That's why you can write:
Secondly, if unspecified the type of arguments will default to
whatever is used the first time the compiler encourters a usage.
So if you have:
int somefunction(x, y)
and then later call it with two "char *", the compiler will give it
those types. I thought this was the best approach, as it's pretty
flexible. The other approach is to use void pointers (which I don't like
but that's for other reasons) and cast at every opportunity. It works
but it can unreliable. especially if you doing comparisons which use
pointer-arithmetic. The third approach again is to have specific
inline functions for each argument type, but that's exhaustive. And of
course the simplest approach is to use an argument-type agnostic
pre-processsor macro - which I think you'll find is what I suggested :)
But my god is this getting obscure.
Colm MacCárthaigh Public Key: colm+pgp at stdlib.net
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!