On 5/25/2012 5:22 PM, Raj Pashwar wrote:
> On Tue, 22 May 2012 00:15:32 -0700, nick_keighley_nospam wrote:
>> On Monday, May 21, 2012 10:53:26 PM UTC+1, Raj Pashwar wrote:
>>
>>> I would like to define a variable of void type. However I get compiler
>>> errors:
>>>
>>> void x; // error: variable or field ‘x’ declared void
>>>
>>> Infact there is a typedef and I want to allow the defined type to be,
>>> void. However, the error is the same.
>>
>> there is no such thing as a void type. What do you think it means. If
>> you explain we might be able to tell you how to achieve what you want
>> some other way.
>
> Thanks for the many replies, just got back from a trip. Sorry I don't
> have time to read them all fully, this thread has got too long.
Oh, I see. *We* can spend *our* time writing answers to your
question, but *you* can't be bothered to read them? Sweet ...
> The situation is this: I have a typedef'd variable. This might be
> typedef'd to say FILE*:
>
> typedef FILE* mytype;
>
> and then the code
> mytype x;
>
> compiles fine.
>
> However, if instead it is typedef'd to void:
>
> typedef void mytype;
>
> then the same code
> mytype x;
>
> no longer compiles.
>
> I hope this is clearer.
Several respondents have explained why it won't compile.
One thing remains UNclear: What are you trying to achieve?
The meaningless `void x;' (in whatever spelling) won't help, so
simply repeating that it doesn't gets us nowhere. Tell us what
you want to accomplish, and someone will quite likely suggest an
approach that will get you nearer your goal.
Assuming you take the trouble to read the suggestion, that is.
--
Eric Sosman
d