Better HN
topnewbestaskshowjobs
Log inSign up

aciuix

1 karma · joined Jun 30, 2015 (11y ago) · 10 submissions

Submissions

comment 11y ago · link · parent

You 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.

comment 11y ago · link · parent

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.

comment 11y ago · link · parent

Checking future result of arithmetic where a wraparound is undesired or undefined, is a basic skill every C programmer should know.

C is not a scripting language. If you use the tools available to you, and don't abuse the language, then it is fairly hard to cause undefined behavior.

comment 11y ago · link · parent

I think it is a matter of being consistent. Both ways have certain syntactic dis/advantages.

The first one enables you to have the function call directly in the if statement, but requires you to define a variable beforehand.

The latter gives you the option to check the return value, pass a NULL, if you don't need it for example, and use the return value directly.

comment 11y ago · link · parent

The example shown in the article is in fact undefined behavior:

6.3.2.1,p2 If the lvalue designates an object of automatic storage duration that could have been declared with the register storage class (never had its address taken), and that object is uninitialized (not declared with an initializer and no assignment to it has been performed prior to use), the behavior is undefined.

comment 11y ago · link · parent

For that to happen the programmer had to be overly clever in the first place, in which case it is his own fault.

If you stick to what is taught in any good tutorial/book, you don't even have to think about problems like this.

But if you decide to play with fire, then you should read the Standard and understand it.

comment 11y ago · link · parent

It seems the movie is going to be very pro-Snowden.

HN readers should instead watch CITIZENFOUR, but general population will find it boring, so I guess this new movie is a good thing.