pointer cast

C

Carlos F.

Hi everyboy, somebody could tell me what meen the following cast:

a = (struct foo 8) b
c = int (func) (int)

Thanks

Carlos
 
C

Christopher Benson-Manica

Carlos F. said:
a = (struct foo 8) b

If you meant (struct foo *) b, it's pretty self explanatory - cast b
to a foo pointer and assign it to a. Whether it results in
well-defined behavior or not depends on what a and b are declared as
and what's happened prior to the line in question.
c = int (func) (int)

Depends on what func is, and it's probably illegal anyway unless func
is an obfuscated macro. Post more code.
 
K

Karthik

Carlos said:
Hi everyboy, somebody could tell me what meen the following cast:

a = (struct foo 8) b
Did u mean -
a = (struct foo *) b

Then you are casting pointer to type b to pointer to type a.
c = int (func) (int)
Not sure with this syntax .. Do you want to check that ?
 
C

CBFalconer

Carlos F. said:
Hi everyboy, somebody could tell me what meen the following cast:

a = (struct foo 8) b

This is a syntax error.
c = int (func) (int)

If func exists both as a functional macro, and as a callable
function, this forces the actual function to be called. The macro
can only be called by "func(" which this is not.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,141
Messages
2,570,817
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top