Skip to content

704. Binary Search#8

Open
ryosuketc wants to merge 2 commits intomainfrom
704_binary_search
Open

704. Binary Search#8
ryosuketc wants to merge 2 commits intomainfrom
704_binary_search

Conversation

@ryosuketc
Copy link
Owner

* これイマイチどのレイヤーに属する概念なのかわからない。OS CPU? 言語? GCC だったらこれ、clang だったらこれとかが決まっている?
* https://www.jpcert.or.jp/sc-rules/c-int00-c.html
* 言語の処理系の話なのかなたぶん
* 「ふつう」のデータモデルってどれなの? C++ Standard? でも int は at least 16 bits らしい。
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

int や long などの実際のサイズがいくらになるかは言語処理系の話ですね。

C, C++ は、衛星に組み込む小さなチップからスーパーコンピュータまでを想定している言語なので、処理系によって異なるサイズにしていいことになっています。とはいえ、最低の大きさや大小関係は保証されています。

int 以外使うな
int は「その処理系にとって一番使いやすいサイズ」という意味なので「軽率に使ってよい」と思うのですが、「それを使いたくない理由はあるが、しかし、何ビットかを明示しない」という状況があるのか、という考え方は理解できますね。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants