News for hackers. Stuff that matters.
Re:Understanding Integer Overflow in C/C++ (2012) [pdf] by ArkyBeagle on Saturday July 09, 2016 @03:51PM (#12062990)
Almost all the integers I use in 'C' are highly constrained. I try very hard ( and nearly always succeed ) in writing code that manages those constraints properly. This may include oversubscribing integers - using a long long instead of a long, perhaps.

This involves at least doing a depth-first examination of all invocations of that operation, and possibly writing tests for all of them. That encourages keeping things local.

I think the safety-think here is slightly inappropriate. Of course you can do it wrong. But it is in no way an unreasonable expectation that you not do that.

And again- for the general population out there - perhaps 'C' is not for you. I am a 'C' programmer only because of path dependencies in what's happened to me. I would not recommend it to anyone. That's not elitist - it's just how things played out.

Re:Understanding Integer Overflow in C/C++ (2012) [pdf] by 0xmohit on Sunday July 10, 2016 @01:50AM (#12064704)
Have you tried using tis-interpreter [0] (an interpreter of C for detecting undefined behavior written in OCaml) written by Pascal Cuoq [1].

[0] https://github.com/TrustInSoft/tis-interpreter

[1] http://stackoverflow.com/users/139746/pascal-cuoq

Re:Understanding Integer Overflow in C/C++ (2012) [pdf] by ArkyBeagle on Sunday July 10, 2016 @01:31PM (#12066333)
I cannot say that I have. Looks very interesting. Thanks!
Re:Understanding Integer Overflow in C/C++ (2012) [pdf] by jstarks on Saturday July 09, 2016 @04:42PM (#12063237)
I think it's apparent that we write in C because of network effects and not because it's the best tool for the job. It's great that people like you can handle it, but I'd much rather write in a language that keeps my stupid mistakes from becoming expensive security holes. It allows me to write code faster and to work with other non-perfect programmers.
Re:Understanding Integer Overflow in C/C++ (2012) [pdf] by posterboy on Saturday July 09, 2016 @06:11PM (#12063567)
> network effects

C, like unix, is a small payload spreading like a virus, depending on the coder to keep it alive. The simplicity and the emergent behavior are as much an evolutionary advantage as a burden because of the UB. At 600 pages, the standard is not really simple anymore, as the RNA accrues more inputs from different vectors.

I started to read the The UNIX-Haters Handbook [1] after I installed a Windows VM and saw the link here the other day.

1: http://web.mit.edu/~simsong/www/ugh.pdf

Re:Understanding Integer Overflow in C/C++ (2012) [pdf] by ArkyBeagle on Saturday July 09, 2016 @05:06PM (#12063329)
Yeah, but whither faster? When I was an imperfect programmer ( perfect to some epsilon TBD ) I wanted to be a more perfect programmer. This was not without cost.

I suppose if you're not interested in that ( and I understand that impulse, believe me ) then ...

I have to, by training, attribute all defects to process and human behavior. But as things emerge, maybe the tools will really fill the gap. But again, at a cost.

I am, say, pretty good with Python but I am by no means a master. It would take having a full time exposure for months, perhaps years to make that claim. And this fragments us. It may well be that I'd actually be better fit for a job using Python but because I can't make this claim now, we get a false negative on fitness.

I'm just using "me" and "Python" to construct an example.