[Swift] If the support of the application is iOS 11 or later, it was not necessary to use Int and Int64 properly

I've been careful to declare variables with "Int64 for integers whose values can be big, Int for integers that don't", but depending on the execution environment, such consideration is unnecessary. , Is the story.

Prerequisite environment for this article: ・ IOS 11 or later ・ Swift 5

As a background to the consideration at the beginning, This is because the maximum and minimum values of Int have the characteristic that ** "the execution environment differs depending on whether it is 32bit or 64bit", and the range is narrow if it is 32bit **.

Type Maximum value minimum value
Int 2147483647
9223372036854775807
-2147483648
-9223372036854775808
(Execution environment depends on 32bit or 64bit)
Int64 9223372036854775807 -9223372036854775808

Quote: Unexpectedly unknown Swift numeric type detailed specifications

So, in the 32-bit environment Int, for example, if the value to be handled is the amount (yen), the maximum value is 2,147 million yen, so in the case of a celebrity, the application may crash.

However, if you think about it, the app I'm currently working on can only be used on iPhones with iOS 11 or later.

After checking, it seems that ** iOS 11 or later does not have a 32-bit execution environment **.

Reference: iOS device screen size / supported OS quick reference table (iOS7-12)

That means that if the app supports only iOS 11 or later, there is no point in using Int and Int64 properly **, so the consideration at the beginning was unnecessary.

Recommended Posts

[Swift] If the support of the application is iOS 11 or later, it was not necessary to use Int and Int64 properly
It is difficult to use the empty string or date of DBUnit, so fix it and use it.
[Swift UI] How to get the startup status of the application [iOS]
Get the type of an array element to determine if it is an array
Is it possible to put the library (aar) in the Android library (aar) and use it?
[Swift5] How to compare specific times to determine if it is before or after
[Swift] What to do if the app icon is set but not reflected
[Spring Boot] If you use Spring Boot, it was convenient to use a lot of util.
Is it mainstream not to write the closing tag of <P> tag in Javadoc?
Since the argument of link_to is nil (null) and an unexpected link was generated, I tried to verify it
What to do if the breakpoint is shaded and does not stop during debugging
The question of which is better, if or switch
If you want to make a Java application a Docker image, it is convenient to use jib.
Even if I write the setting of STRICT_QUOTE_ESCAPING in CATALINA_OPTS in tomcat8.5, it is not reflected.
[Note] What to do if bundle install in Chapter 3 of the rails tutorial is not possible
In order not to confuse the understanding of getters and setters, [Do not use accessors for anything! ]
About the solution to the problem that the log of logback is not output when the web application is stopped
Is it easy for the user to use when implementing general-purpose functions? Let's be aware of