What was the most dangerous programming mistake you have made in C?

前端 未结 26 1233
南方客
南方客 2021-02-03 12:46

I am an intermediate C programmer. If you have made any coding mistake that you came to know later that it was the most hazardous / harmful to the total application please share

26条回答
  •  花落未央
    2021-02-03 13:22

    The most dangerous thing I ever did in C was trying to write code which managed my own memory. Effectively, this means the most dangerous thing I ever did in C was write C code. (I hear that you can get around it these days. Hip hip for sanity. Use those approaches whenever appropriate!)

    • I don't write paging algorithms -- OS geeks do that for me.
    • I don't write database caching schemes -- database geeks do that for me.
    • I don't build L2 processor caches -- hardware geeks do that for me.

    And I do not manage memory.

    Someone else manages my memory for me -- someone who can design better than I can, and test better than I can, and code better than I can, and patch when they make critical security-compromising mistakes which only get noticed 10 years later because absolutely everyone who attempts to allocate memory fails some of the time.

提交回复
热议问题