lo******@tlen.pl said:
is it possible to do some kind of function overloading in c? and that
the return type is different
Function overloading is not *supported* in C. There is no syntax for it, so
to speak. Whether it is *possible* is another question. I would answer an
unequivocal "no", were it not for the fact that comp.lang.c subscribers
frequently surprise me with their ingenuity! Nevertheless, any solution is
likely to be so contorted that you may find it better to find another way
around your problem.
I may be mistaken here, but I have a hunch that you have not asked the
question you perhaps ought to be asking. It seems to me that there is some
task (call it X) that you need to achieve, and you've thought about it, and
decided that function overloading would be a way to achieve that task, and
so you're asking about function overloading, whereas you may find it more
productive to ask about ways in which X itself, whatever it may be, can be
achieved.
If any practical programming language is Turing-complete, so is C. (And if
none is, C fails in that regard only in the same way that other languages
do.) Therefore, if it's computable, C can compute it. That does not,
however, mean "if some other language has feature F, then C must have
feature F too". Different languages provide different ways of getting from
a problem to a solution. Just because C doesn't support function
overloading, that doesn't mean you can't solve your /real/ problem in C.
Incidentally, you hint that you wish to be able to distinguish between
functions of the same name purely by virtue of their having different
return types. Even C++ (which *does* support function overloading) cannot
do this.
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: normal service will be restored as soon as possible. Please do not
adjust your email clients.