|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
I am a newbie, and looking through some code which I have been given
as an example of "how to do things right", I see functions like this:- void FunctionName(void) but in the function itself, after the "workings" I find :- return StructName; } This seems very strange. It is declared as having no return type, but yet it is written to return quite a big thing, and plainly the program won't work unless it does return it. What's the explanation? Michael Bell -- |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
Michael Bell wrote:
> I am a newbie, and looking through some code which I have been given > as an example of "how to do things right", I see functions like this:- > > void FunctionName(void) > > but in the function itself, after the "workings" I find :- > > return StructName; > } > > > This seems very strange. It is declared as having no return type, but > yet it is written to return quite a big thing, and plainly the program > won't work unless it does return it. What's the explanation? Somebody must have screwed up. Does it compile at all? AFAICT, it shouldn't. But then again, you didn't post the complete code... V -- Please remove capital 'A's when replying by e-mail I do not respond to top-posted replies, please don't ask |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
Michael Bell wrote:
> I am a newbie, and looking through some code which I have been given > as an example of "how to do things right", I see functions like this:- > > void FunctionName(void) > > but in the function itself, after the "workings" I find :- > > return StructName; > } > > > This seems very strange. It is declared as having no return type, but > yet it is written to return quite a big thing, and plainly the > program won't work unless it does return it. What's the explanation? Cut and paste the entire piece of code in question, not your interpretation. Then we can see what we really have. Brian |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
Default User wrote:
> Cut and paste the entire piece of code in question Wouldn't that destroy the original? Sounds like a bad idea. |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
Juha Nieminen wrote:
> Default User wrote: > > Cut and paste the entire piece of code in question > > Wouldn't that destroy the original? Sounds like a bad idea. Har. I'm old enough to remember the days when the phrase meant exactly that, you cut out the text with scissors or and Exact-o and pasted it into your document. Brian |
|
![]() |
| Outils de la discussion | |
|
|