3 ms·
You really shouldn't trust every article about C on the internet. Most of them make mistakes. If you are using gcc, you can start with the flag: -ftrapv. It do
by aciuix 11y ago
You really shouldn't trust every article about C on the internet. Most of them make mistakes.
If you are using gcc, you can start with the flag: -ftrapv. It does everything for you.
- rcfox 11y agoAh, but then you're not writing C anymore, you're writing GCC-flavoured C. If it helps: The author of that article, John Regehr, is a professor of computer science who spends a great deal of time studying undefined behaviour.
- deleted 11y ago[deleted]
- aciuix 11y agoYou are really something else: -Strawman argument. -Appeal to authority. Next time stick to the issue, you will find the debate will be much more rewarding for both parties.
- pgeorgi 11y agoAnd with every discussion of undefined behavior in C on this site, there's bound to be some user who's telling the world how they're "holding it wrong". I guess the best solution is to move to other languages (IIRC Ada and rust are relatively free from surprises in their UB) and let language lawyers optimize C to death (by attrition).