| View previous topic :: View next topic |
| Author |
Message |
Guybrush Threepwood Guest
|
Posted: Thu Feb 26, 2004 6:32 pm Post subject: void* |
|
|
a function declared as
void* someFunction()
{
....
}
what does it exactly return?
|
|
| Back to top |
|
 |
Karl Heinz Buchegger Guest
|
Posted: Thu Feb 26, 2004 6:41 pm Post subject: Re: void* |
|
|
Guybrush Threepwood wrote:
| Quote: |
a function declared as
void* someFunction()
{
...
}
what does it exactly return?
|
a pointer to void.
That is a pointer to ... aehm ... something, but nobody
knows to what exactly.
--
Karl Heinz Buchegger
[email]kbuchegg (AT) gascad (DOT) at[/email]
|
|
| Back to top |
|
 |
Rolf Magnus Guest
|
Posted: Thu Feb 26, 2004 6:45 pm Post subject: Re: void* |
|
|
Karl Heinz Buchegger wrote:
| Quote: | Guybrush Threepwood wrote:
a function declared as
void* someFunction()
{
...
}
what does it exactly return?
a pointer to void.
That is a pointer to ... aehm ... something, but nobody
knows to what exactly.
|
I hope that there is at least somebody out there who knows what it is.
If not, why return a pointer to it? ;-)
|
|
| Back to top |
|
 |
E. Robert Tisdale Guest
|
Posted: Thu Feb 26, 2004 6:50 pm Post subject: Re: void* |
|
|
Guybrush Threepwood wrote:
| Quote: | a function declared as
void* someFunction()
{
...
}
|
That's *not* a declaration.
It's a definition.
The declaration
void* someFunction(void);
informs the compiler that someFunction returns a pointer to memory.
| Quote: | what does it exactly return?
|
This depends upon the definition
void* someFunction(void) {
return malloc(sizeof(int));
}
for example.
|
|
| Back to top |
|
 |
Jeff Schwab Guest
|
Posted: Thu Feb 26, 2004 7:13 pm Post subject: Re: void* |
|
|
E. Robert Tisdale wrote:
| Quote: | Guybrush Threepwood wrote:
a function declared as
void* someFunction()
{
...
}
That's *not* a declaration.
|
Yes, it is.
| Quote: | It's a definition.
|
It's both.
|
|
| Back to top |
|
 |
Mike Wahler Guest
|
Posted: Thu Feb 26, 2004 7:19 pm Post subject: Re: void* |
|
|
"E. Robert Tisdale" <E.Robert.Tisdale (AT) jpl (DOT) nasa.gov> wrote
| Quote: | Guybrush Threepwood wrote:
a function declared as
void* someFunction()
{
...
}
That's *not* a declaration.
|
Oh, yes it certainly is (barring the syntax error)
See 3.1 / 2 and 7 / 1.
| Quote: | It's a definition.
|
Yes, it's that as well.
| Quote: | The declaration
void* someFunction(void);
informs the compiler that someFunction returns a pointer to memory.
|
So does the declaration posted by the OP.
-Mike
|
|
| Back to top |
|
 |
Makhno Guest
|
Posted: Thu Feb 26, 2004 8:14 pm Post subject: Re: void* |
|
|
| Quote: | void* someFunction()
{
...
}
That's *not* a declaration.
Oh, yes it certainly is (barring the syntax error)
|
What syntax error?
|
|
| Back to top |
|
 |
Mike Wahler Guest
|
Posted: Thu Feb 26, 2004 8:28 pm Post subject: Re: void* |
|
|
"Makhno" <root (AT) 127 (DOT) 0.0.1> wrote
| Quote: | void* someFunction()
{
...
}
That's *not* a declaration.
Oh, yes it certainly is (barring the syntax error)
What syntax error?
|
The line with the three periods.
If you want to use such to indicate e.g.
"other stuff goes here", put it in a comment.
I know this case isn't really a good example, but
you'll find that more help is available if posted
code can be copy-pasted and compiled verbatim.
-Mike
|
|
| Back to top |
|
 |
Guybrush Threepwood Guest
|
Posted: Thu Feb 26, 2004 9:08 pm Post subject: Re: void* |
|
|
Mike Wahler wrote:
| Quote: | "Makhno" <root (AT) 127 (DOT) 0.0.1> wrote in message
news:c1lk6r$uh3$1 (AT) news7 (DOT) svr.pol.co.uk...
void* someFunction()
{
...
}
That's *not* a declaration.
Oh, yes it certainly is (barring the syntax error)
What syntax error?
The line with the three periods.
If you want to use such to indicate e.g.
"other stuff goes here", put it in a comment.
I know this case isn't really a good example, but
you'll find that more help is available if posted
code can be copy-pasted and compiled verbatim.
-Mike
sigh |
|
|
| Back to top |
|
 |
|