跳转到内容
View in the app

A better way to browse. Learn more.

彼岸论坛

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
欢迎抵达彼岸 彼岸花开 此处谁在 -彼岸论坛

[编程] C++的 long 是一个很尴尬的存在。

发表于
long 在 32 位编译器里,是 32 位整型。在 64 位编译器里,是 64 位整型。

为了避免代码歧义,我一般会用 long long 来表示 64 位整型,这样不管 32 位还是 64 位编译,都能保持一致性。

但是,官方有一个 INT64_C 的宏,是下面这样定义的。也就是官方推荐 64 位编译器,优先选用 long 为 64 位整型。


#if defined(__LP64__)
#define INT64_C(c) c ## L
#else
#define INT64_C(c) c ## LL
#endif


这就很尴尬了,我代码里全部都是 long long ,和 long 并不兼容,属于两个不同类型,陷入了深深的沉思。最后决定,我不用官方的 INT64_C 宏了,属于把人带偏的节奏。

Featured Replies

No posts to show

创建帐户或登录来提出意见

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.