Would making plain int 64-bit break a lot of reasonable code?

后端 未结 8 2087
独厮守ぢ
独厮守ぢ 2021-02-19 03:12

Until recently, I\'d considered the decision by most systems implementors/vendors to keep plain int 32-bit even on 64-bit machines a sort of expedient wart. With mo

8条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-19 04:12

    "Reasonable Code"...

    Well... the thing about development is, you write and fix it and then it works... and then you stop!

    And maybe you've been burned a lot so you stay well within the safe ranges of certain features, and maybe you haven't been burned in that particular way so you don't realize that you're relying on something that could kind-of change.

    Or even that you're relying on a bug.

    On olden Mac 68000 compilers, int was 16 bit and long was 32. But even then most extant C code assumed an int was 32, so typical code you found on a newsgroup wouldn't work. (Oh, and Mac didn't have printf, but I digress.)

    So, what I'm getting at is, yes, if you change anything, then some things will break.

提交回复
热议问题