Skip to content

Comment on The Apple goto fail vulnerability: lessons learned (2014)

Comments

One of the ideas to make this error visible is to forbid misleading indentation (section 3.5). It would be cool if the IDE can show this goof straight away..

These days, both GCC and Clang have a compiler warning about it:

https://developers.redhat.com/blog/2016/02/26/gcc-6-wmislead...

However, for some reason, while GCC puts it under -Wall, Clang (which Apple uses) doesn't enable it even with -Wall -Wextra; you have to manually add -Wmisleading-indentation. It's also not enabled by the default Xcode template.

Code Formating tools can help avoid this too.

At some point we should juat switch to editing abstract syntax trees instead of raw text. Then formatting is irrelevant, the structure is always clear, and each developer can choose their own way to view the code.

That's basically the idea behind lisp (until you get into macros).

Well, when you edit with and require a code formatting tool as a part of your development lifecycle, you're basically there.

True, though you'd have to run the formatting tool with different rules on both checkout and commit for developers to be able to use their own preferred formats. Also keeping the syntax tree would make non-textual displays and visualizations easier.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.