Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • 8
    The correct way to handle platform specific types is to typedef them. Commented Jul 25, 2015 at 6:42
  • 1
    @cmaster-reinstatemonica use a using statement, not typedef. Commented Sep 26, 2020 at 1:23
  • 2
    @user997112 The cppreference.com says: "There is no difference between a type alias declaration and typedef declaration." As such, I don't care whether you use typedef or using to declare your type alias as long as you provide a proper portable name to your platform specific type. Your styleguide may declare that either using or typedef should be used for a specific project, but the moment such a rule leaves that scope, it becomes nothing more or less than a religious rule. And I consider religious rules harmful in the context of programming. Commented Sep 26, 2020 at 7:13
  • So you think they added a new keyword with no benefit? Commented Sep 26, 2020 at 17:09
  • Might cause UB if a value that fits in PLATFORM1 doesn't fit in some other platform's int. I'd definitely rather see a typedef or using. Commented Feb 23, 2021 at 18:09