void

Is void** a acceptable type in ANSI-C

I have seen a function whose prototype is : int myfunc(void** ppt) This function is called in a C file as a = myfunc(mystruct **var1); where mystruct is typedef for one of structure we have. This works wihtout any compilation errors in MSVC6.0, But when i compile it with some other C compiler, it gives an error at place where thi...

variable or field declared void

Hello I am working in c++: I have a function called: void initializeJSP(string Experiment) And in my MyJSP.h file I have: 2: void initializeJSP(string Experiment); And when I compile I get this error: MyJSP.h:2 error: variable or field initializeJSP declared void, the error is Where is the problem?. Thank you. ...

Pointer to void in C++?

Hello, I'm reading some code in the Ogre3D implementation, and I can't understand what does a void*-typed variable could mean. What does a pointer to void means in C++? ...

is f(void) deprecated in modern C and C++

I'm currently refactoring/tidying up some old C code used in a C++ project, and regularly see functions such as int f(void) which I would tend to write a int f() Is there any reason not to replace (void) with () throughout the codebase in order to improve consistency, or is there a subtle difference between the two that I am unaw...

Print void type in pure C

i have a function like void printMe (void *i) { printf("%d", i); } where i want to pass a void pointer and print it to screen. The above example is fine if the i is integer, float or double but crashes if i is a char. There is no overloading in C like i usually use in C++. So the question is this, can we create a function in C tha...

void* as unknown variable type

Hi, I'm currently working on a sprite engine in C++. I have an abstract class IEngine with a virtual function init_api. This takes in a void*. // Initialise the engines' API // api_params - void* to api parameters for initalisation // hWnd - window handle virtual bool init_api( void* api_params, HWND hWnd ) = 0; I then have a Dir...

Uses for the Java Void Reference Type?

There is a Java Void -- uppercase V-- reference type. The only situation I have ever seen it used is to parameterize Callables final Callable<Void> callable = new Callable<Void>() { public Void call() { foobar(); return null; } }; Are there any other uses for the Java V...

what is the point of void in javascript

I have seem some people put their code inside of the void function. I have also seen this in hrefs: javascript:void(0) which doesnt seem any better than writing javascript:; so, what is the justification of using the void function? ...

What do I return if the return type of a method is Void? (Not void!)

Due to the use of Generics in Java I ended up in having to implement a function having Void as return type: public Void doSomething() { //... } and the compiler demands that I return something. For now I'm just returning null, but I'm wondering if that is good coding practice... I've also tried Void.class, void, Void.TYPE, new Vo...

casting unused return values to void

int fn(); void whatever() { (void) fn(); } Is there any reason for casting an unused return value to void, or am I right in thinking it's a complete waste of time? Follow up: Well that seems pretty comprehensive. I suppose it's better than commenting an unused return value since self documenting code is better than comments. P...

C void arguments

What is better: void foo() or void foo(void)? With void it looks ugly and inconsistent, but I've been told that it is good. Is this true? Edit: I know some old compilers do weird things, but if I'm using just GCC, is void foo() Ok? Will foo(bar); then be accepted? ...

return key word in a void method in java?

Hi all. Looking a path finding tutorial here (http://www.cokeandcode.com/pathfinding) which i was linked to from SO :) good work people. Working in integrating the code into my game, and i noticed a "return;" line inside a void method. class is PathTest on website, line 130. I know im a novice at java, but can anyone tell me why its th...

C# - How do I Pass a delegate into another method?

I'm writing a class for managing my threading. How do I pass my method that needs threading into my helper class? All that I'll be doing is creating a new thread and passing the method I've passed through into a new ThreadStart(). Thanks in advance. ...

C# MethodInfo getReturnType

I created an instance of MethodInfo: MethodInfo theMethod = typeof(Reciever).GetMethod("methodName", parameterTypes); Now I want to know if theMethod's return type is void. How? ...

Which is preferred: foo(void) or foo() in C++

I have seen two styles of defining conversion operator overload in C++, operator int* (void) const operator int*() const Question 1. I think the two styles (whether add void or not) have the same function, correct? Question 2. Any preference which is better? ...

What does "(void) new" mean in C++?

I've been looking at a Qt tutorial which uses a construction I haven't seen before: (void) new QShortcut(Qt::Key_Enter, this, SLOT(fire())); (void) new QShortcut(Qt::Key_Return, this, SLOT(fire())); (void) new QShortcut(Qt::CTRL + Qt::Key_Q, this, SLOT(close())); I've tried this without the (void) and it still compiles and works, s...

Reading and assigning a void type parameter

I wrote two methods with a void type parameter: procedure Method1(const MyVar; size: cardinal); var Arr: array of byte; begin SetLength(Arr, size); {now copy the data from MyVar to Arr, but how?} end; procedure Method2(var MyVar; size: cardinal); var Arr: array of byte; begin SetLength(Arr, size); {return the data from th...

in c: func(void) vs. func()

When a C function does not accept any arguments, does it have to be declared/defined with a "void" parameter by the language rules? PC-Lint seems to have problems when there's nothing at all in the argument-list, and I was wondering if it's something in the language syntax that I don't know about. Edit: I just found a duplicate (back-d...

General programming - calling a non void method but not using value

This is general programming, but if it makes a difference, I'm using objective-c. Suppose there's a method that returns a value, and also performs some actions, but you don't care about the value it returns, only the stuff that it does. Would you just call the method as if it was void? Or place the result in a variable and then delete it...

How does System.Void type specify a return value type for a method that does not return a value?

Is this the actual type methods without a return value return? If so, where is the distinction that "nothing" is returned made? ...