Why do we need to mention alias in every file?

We have included FBullCowGame.h in every cpp file. so is there any specific reason why we include alias like
" using int32 = int " in every file? can’t we put it in our FBullCowGame.h file?

1 Like

-Seems that the code runs fine without explicitly declare those aliases again in every file; just as you said, they’re in [ FBullCowGame.h ] . However, maybe Ben is just teaching us something that might save us from unintended conflicts on the long run (massive code). Or, maybe he’s trying to emphasize the need to override FString with FText when it comes back to [ main.cpp ] .

I’m not an expert still… But, I was just trying to help; because - apparently - this forum is half-dead by now!

P.S. Oh, and check out this thread: Using int32 = int; <-- Nt needed in FBullCowGame.cpp

I think the best thing is to ONLY write down the substitution where it relay needs to be. For the using int32 = int; statement I suggest you only put it in the header file (the one that ends with .h) . It works fine since it is included in the other files.

For the using Ftext and Fstring however you need one in main and another in the header file since we are calling the substituted type by different names in respective file. Ftext in main and Fstring in the rest.

It doesn’t hurt to put it in every file as all clones will be ignored by compiler during compilation. But it will hurt if lose a lot of time due to intellisense errors for example. it happens quite often with Visual Studio.
But true it’s ok to put in header files only.

Privacy & Terms