Possible Duplicate:
What is the size of void?
Hi all !
I am using gcc for compiling my C programs, just discovered accidentally that the sizeof(void) is 1 byte in C.
Is there any explanation for this ? I always thought it to be ZERO (if it really stores nothing) !
Thanks !
...
Consider the following snippet:
void Foo()
{
// ...
}
void Bar()
{
return Foo();
}
What is a legitimate reason to use the above in C++ as opposed to the more common approach:
void Foo()
{
// ...
}
void Bar()
{
Foo();
// no more expressions -- i.e., implicit return here
}
...
how to know the number and type of parameters?
how to know the return type?
how to check whether the return type is void?
...
Hi,
Can I know if void is data type in "C"? what type of values it can store, if we have int, float, char etc to store the values why is void needed?
...
I have a C interface that looks like this (simplified):
extern bool Operation(void ** ppData);
extern float GetFieldValue(void* pData);
extern void Cleanup(p);
which is used as follows:
void * p = NULL;
float theAnswer = 0.0f;
if (Operation(&p))
{
theAnswer = GetFieldValue(p);
Cleanup(p);
}
You'll note that Operatio...
I want to use moq a void method and set a value to a protected property when is called.
public class MyClass{ public Guid Id {get; protected set; } }
public interface IMyRespository { public void Save(MyClass myClass); }
Something like:
var moq = new Mock<IMyRespository>();
var my = new MyClass();
moq.Setup(x=>x.Save(my));
I want...
I was wondering, why can't there be a void data type that is not a pointer?
Surely you could get past the whole determined size thing by having
void4
void8
void32
And then only being allowed to 'cast' a void data type to another class if its size is equal or under to the classes size.
Is there something that I'm missing, or does the...
Just of a curiosity, is there any practical use of "Void" struct
except in Reflection ?
...
I'm new to web-design and javascript, and I don't understand why it's common for web designers to use the void(0) syntax below:
<a onclick="this.blur();return false;" href="javascript:void(0);" class="btn">
Since this actually shows itself in the lower left hand corner of the browser, why not come up with a way to make it more user f...
I've got two android apps, one with a public void. How would the other app call this function?
...
For example, I have:
void(temperature, pressure,time)
{
int i;
double results[10];
for (i = 0 ; i <= 9 ; i++)
{
fx(temperature, pressure, time);
results[i]=fx[i];
}
}
(P/S: above is the simplified version of my real problem)
fx by itself is of course another ste of codes with equations for calcul...
This is kind of basic but I can't seem to get a hold on this one. Reference here
Are void *p and const void *p sufficiently different? Why would a function use const void * instead of void *?
...
I'm trying to return an invisible value in a scheme function, but can't seem to get anything that WONT be printed to the screen, which is what I need. Is there a value in scheme that can be added to a list which won't be printed in a (display) call?
...
Hello Users,
I have a little Problem, i have implemented the following method to
open an Image:
- (void)ladeImage {
id path = @"http://172.23.1.63:8080/RestfulJava/pics";
NSURL *url = [NSURL URLWithString:path];
NSData *data = [NSData dataWithContentsOfURL:url];
UIImage *img = [[UIImage alloc] initWithData:data];
UIImageView *imgView...
I'm having a problem creating a C# P/invoke wrapper around a third party C library. In particular, the library has a method with the signature
int command(SomeHandle *handle, int commandNum, void *data, int datasize);
It is a wildcard method that does different things depending on commandNum. data can be a pointer to anything, like a s...
My professor has asked us to write a program that uses recursion to solve a fibonacci sequence. This is all pretty normal, but he's asked us to make our function return void. I've been working at this for a few days now and can't find a way to do this.
I have:
void fibonacci(double *n,double *x,double *y,double *result) {
if(*n ...
Is it possible to convert this:
- (id)initWithFrame : (NSRect)frame
{
if (self = [super initWithFrame:frame])
{
[self setFont:[NSFont fontWithName:@"Arial" size:0.0]];
// [self startTask];
}
return self;
}
to make it a void?
thanks,
Elijah
...
I have a trace aspect that should log:
Entering
Exiting (return type is void)
Returning [returned object]
Throwinig [Exception message]
I am having problems with the second. How do I create an advice for this case without double-logging all exits that also return something as is the case now when I have one @After advice and one @Aft...
I have to different classe:
class text
{ };
class element
{ };
And I want to store them in the class node:
template <typename T>
class node
{
T cargo;
std::vector<void*> children;
node(T cargo) : cargo(cargo)
{ };
void add_child(T node)
{
this->children.push_back((void*) node);
}
}
So I would...
So, I found a similar question here, but the answers are more about style and whether or not you are able to do it.
My question is, what actually happens when you call a non-void function that returns an object, but you never assign or use said returned object? So, less about whether or not you can, because I absolutely know you can and...