473,398 Members | 2,165 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

void*

a function declared as

void* someFunction()
{
....
}

what does it exactly return?
Jul 22 '05 #1
8 1252
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.

--
Karl Heinz Buchegger
kb******@gascad.at
Jul 22 '05 #2
Karl Heinz Buchegger wrote:
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? ;-)

Jul 22 '05 #3
Guybrush Threepwood wrote:
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.
what does it exactly return?


This depends upon the definition

void* someFunction(void) {
return malloc(sizeof(int));
}

for example.

Jul 22 '05 #4
E. Robert Tisdale wrote:
Guybrush Threepwood wrote:
a function declared as

void* someFunction()
{
...
}

That's *not* a declaration.


Yes, it is.
It's a definition.


It's both.

Jul 22 '05 #5
"E. Robert Tisdale" <E.**************@jpl.nasa.gov> wrote in message
news:40**************@jpl.nasa.gov...
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.
It's a definition.
Yes, it's that as well.
The declaration

void* someFunction(void);

informs the compiler that someFunction returns a pointer to memory.


So does the declaration posted by the OP.
-Mike
Jul 22 '05 #6
> > > void* someFunction()
{
...
}


That's *not* a declaration.


Oh, yes it certainly is (barring the syntax error)


What syntax error?
Jul 22 '05 #7

"Makhno" <ro**@127.0.0.1> wrote in message
news:c1**********@news7.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
Jul 22 '05 #8
Mike Wahler wrote:
"Makhno" <ro**@127.0.0.1> wrote in message
news:c1**********@news7.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>
Jul 22 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

192
by: Kwan Ting | last post by:
The_Sage, I see you've gotten yourself a twin asking for program in comp.lang.c++ . http://groups.google.co.uk/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&th=45cd1b289c71c33c&rnum=1 If you the oh so mighty...
15
by: Stig Brautaset | last post by:
Hi group, I'm playing with a little generic linked list/stack library, and have a little problem with the interface of the pop() function. If I used a struct like this it would be simple: ...
188
by: infobahn | last post by:
printf("%p\n", (void *)0); /* UB, or not? Please explain your answer. */
7
by: sunglo | last post by:
My doubt comes from trying to understand how thread return values work (I know, it's off topic here), and I'm wondering about the meaning of the "void **" parameter that pthread_join expects (I...
9
by: Juggernaut | last post by:
I am trying to create a p_thread pthread_create(&threads, &attr, Teste, (void *)var); where var is a char variable. But this doesnt't work, I get this message: test.c:58: warning: cast to pointer...
5
by: Stijn van Dongen | last post by:
A question about void*. I have a hash library where the hash create function accepts functions unsigned (*hash)(const void *a) int (*cmp) (const void *a, const void *b) The insert function...
56
by: maadhuu | last post by:
hello, this is a piece of code ,which is giving an error. #include<stdio.h> int main() { int a =10; void *p = &a; printf("%d ", *p ); //error....why should it //be an error ?can't the...
27
by: Erik de Castro Lopo | last post by:
Hi all, The GNU C compiler allows a void pointer to be incremented and the behaviour is equivalent to incrementing a char pointer. Is this legal C99 or is this a GNU C extention? Thanks in...
18
by: Giannis Papadopoulos | last post by:
According to the standard (ISO C99 draft WG14/N1124), void is the incomplete type that cannot be completed and comprises the empty set of values. Since it declares the absense of a value can it be...
4
by: brianhray | last post by:
Hello: I am writing a C interface and was curious how/why a void* can be used as a reference parameter. //////////////////////////////////////////////////////////// // WORKS: // Client1.h...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.