C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

void*

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
Guybrush Threepwood
Guest





PostPosted: Thu Feb 26, 2004 6:32 pm    Post subject: void* Reply with quote



a function declared as

void* someFunction()
{
....
}

what does it exactly return?
Back to top
Karl Heinz Buchegger
Guest





PostPosted: Thu Feb 26, 2004 6:41 pm    Post subject: Re: void* Reply with quote



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





PostPosted: Thu Feb 26, 2004 6:45 pm    Post subject: Re: void* Reply with quote



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





PostPosted: Thu Feb 26, 2004 6:50 pm    Post subject: Re: void* Reply with quote

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





PostPosted: Thu Feb 26, 2004 7:13 pm    Post subject: Re: void* Reply with quote

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





PostPosted: Thu Feb 26, 2004 7:19 pm    Post subject: Re: void* Reply with quote

"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





PostPosted: Thu Feb 26, 2004 8:14 pm    Post subject: Re: void* Reply with quote

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





PostPosted: Thu Feb 26, 2004 8:28 pm    Post subject: Re: void* Reply with quote


"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





PostPosted: Thu Feb 26, 2004 9:08 pm    Post subject: Re: void* Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.