Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'd suggest that even if it's absolutely necessary, one could at least put something like

    #if (ULONG_MAX < UINTPTR_MAX) && !defined (SUPPRESS_TRUNCATION_ERROR)
    #error Truncating pointers to long is a bad idea here
    #endif
in some source file or another, just so you have some indication whether or not things are going to break when you change the build environment.


  static_assert(sizeof(DWORD) == sizeof(void*), "assume 32-bit pointers");


If we're talking about "undocumented legacy code doing crazy casts," static_assert is probably not an option.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: