5 ms·
Ignoring the basic int type and using a zoo of preprocessor defines instead is what has worked for C all that time. But I still think that native types have th
by usrusr 8y ago
Ignoring the basic int type and using a zoo of preprocessor defines instead is what has worked for C all that time.
But I still think that native types have their place. It can often be quite reasonable to accept serious limitations on narrow machines where the performance gains won by the trade-off are desperately needed, lift those limitations on wider machines and grant an enormous safety margin on the widest architectures. When you dive deeper, the values where this makes sense still tend to be "index-like", as GP stated, but they don't have to strictly be indexes (e.g. IDs, a wider machine will be capable of working on bigger datasets and therefore be more likely to exhaust a given width of IDs, all indexes are identifiers but not all identifiers are indexes)
- geezerjay 8y ago> Ignoring the basic int type and using a zoo of preprocessor defines My C is a bit rusty but why should #defines be used in this scenario? A typedef set in a config.h.in is more than enough to meet the requirements of this usecase.
- icedchai 8y agoWhy do you need your own typedef? stdint.h is available, if you're using a compiler from the past couple of decades at least.