Domanda

Can't I leave out #import "foo.h" in .m file if it's already in the prefix header?

The product still builds successfully when I leave it out. But, I've noticed that the Xcode templates keep them in. Why?

Is the answer the same for #include?

È stato utile?

Soluzione

I don't know why it does this, but it doesn't hurt because #import protects from double #include by checking if something is already #import-ed or #include-d, so no, the same scenario wouldn't work with #include.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top