Reasons to use (or not) stdint

Pros Using well-defined types makes the code far easier and safer to port, as you won’t get any surprises when for example one machine interprets int as 16-bit and another as 32-bit. With stdint.h, what you type is what you get. Using int etc also makes it hard to detect dangerous type promotions. Another advantage … Read more

difference between stdint.h and inttypes.h

stdint.h Including this file is the “minimum requirement” if you want to work with the specified-width integer types of C99 (i.e. int32_t, uint16_t etc.). If you include this file, you will get the definitions of these types, so that you will be able to use these types in declarations of variables and functions and do … Read more

vs

[*] The original intention in C++98 was that you should use <cstdint> in C++, to avoid polluting the global namespace (well, not <cstdint> in particular, that’s only added in C++11, but the <c*> headers in general). However, implementations persisted in putting the symbols into the global namespace anyway, and C++11 ratified this practice[*]. So, you … Read more

How to portably print a int64_t type in C

For int64_t type: #include <inttypes.h> int64_t t; printf(“%” PRId64 “\n”, t); for uint64_t type: #include <inttypes.h> uint64_t t; printf(“%” PRIu64 “\n”, t); you can also use PRIx64 to print in hexadecimal. cppreference.com has a full listing of available macros for all types including intptr_t (PRIxPTR). There are separate macros for scanf, like SCNd64. A typical … Read more

How to print a int64_t type in C

For int64_t type: #include <inttypes.h> int64_t t; printf(“%” PRId64 “\n”, t); for uint64_t type: #include <inttypes.h> uint64_t t; printf(“%” PRIu64 “\n”, t); you can also use PRIx64 to print in hexadecimal. cppreference.com has a full listing of available macros for all types including intptr_t (PRIxPTR). There are separate macros for scanf, like SCNd64. A typical … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)