   Void Pointers question
  I tried to make a function that returns a void pointer, and I don't see why the program will not allow it. Why can't it just be type casted later to assume its use?Can this error be fixed? :: error C2036: 'void *' : unknown sizeAnd the only reason I do this is to avoid a function for each type.. While also avoiding templates if I can.   
  Returning a void* is syntactically fine. Post your code.   ;  It can, you're just using it wrong. You're doing pointer arithmetic on it before the cast, rather than after the cast. Post your code.Also, post your reasons for avoiding templates.   ;  You need to post some code, specifically around the area where the error occurs.  (Make sure to use [ source ] tags--no spaces--when you do.)   ;  Include with the code a brief overview of the high level goal you are trying to achieve.   ;  And muffins.   ;Quote:Original post by SneftelAnd muffins.Absolutely.;  I get the arithmetic now, it didn't know the size of bytes with no cast. Does the void function have to return a void pointer?, I'd much rather do arithmetic within the function. Otherwise I will also be writing to an address the amount to move the pointer.The  'high level goal' is just a simple macro. It puts like things together while trying to optimize memory(less fragments) among other directives I can give it. It will do this and interface with a global buffer of types..   ;  There's no such thing as a void function. Do you mean a function with a void return type? If so, then you can't return anything from it, not even a void pointer. Of course, you also failed to post code or bring muffins, so it's hard to help you.;Quote:Original post by VprMatrix89And the only reason I do this is to avoid a function for each type.. While also avoiding templates if I can.Avoid templates?! Meaning you're using C++ and yet...Is that from lack of experience with them, or from executable size paranoia, or because you're trying to make the life of the next programmer to maintain the code hell, or ...?No code posted yet.Coming up next on things to avoid ... breathing