Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does C struct have run-time identity?

Tags:

c

struct

I can refer C struct with its name. Anyway it looks it doesn't have run-time identity. I mean, there's no symbol for the struct. It's been referred from header files. So I think I can put struct of same name with different fields over multiple .c files without name duplication.

Am I right? Or C struct has it's symbol, so should I avoid duplicated names?

PS. I'm sorry for unclear terms and question, but currently, I can express this only like this. I will update my question as I get more ideas.

like image 267
eonil Avatar asked Jan 17 '23 13:01

eonil


1 Answers

If you're asking if you can reuse a structure name to mean different structures in different translation units, the answer is yes. I wouldn't say it's a good idea, though.

like image 158
Carl Norum Avatar answered Jan 28 '23 14:01

Carl Norum