4 ms·
Whitespace sensitivity also introduces some similar problems. For example, if the printf is indented with spaces and the return foo is indented with tabs, the r
by ufo 13y ago
Whitespace sensitivity also introduces some similar problems. For example, if the printf is indented with spaces and the return foo is indented with tabs, the return will be put outside the if, even though it looks like its inside.
TBH, the real problem with C is not the braces - its that braces are optional.
- meowface 13y ago>For example, if the printf is indented with spaces and the return foo is indented with tabs, the return will be put outside the if, even though it looks like its inside. Python 3 deals with this by throwing a warning about inconsistent use of tabs and spaces before it even finishes parsing the file (so basically before runtime). There's no reason why any other language can't do the same.
- deleted 13y ago[deleted]
- rdtsc 13y agoI think tabs vs spaces problem is silly and nobody should be using tabs. Editor should be showing tabs in red and asking the user to clean them up.
- WildUtah 13y agoI switched from tabs to spaces about a decade ago and I've never regretted it. I seldom find files written by crazy people who think 8 spaces is a viable tab width anymore so I can pretty much adjust to whatever nice 2 space or wasteful 4 space width the original file authors used. Back in the 1970s, I chose tabs to save bytes in my text files. Today I feel like I can afford the extravagance.
- ANTSANTS 13y agoI think the tabs vs spaces problem is silly and nobody should be using spaces[1]. Compilers should treat leading spaces as a syntax error. Clearly we both can't be pleased. ;) [1] Except in Lisp.
- Someone 13y agoEvery social problem has a simple, rational solution: forbid (and strongly enforce it) anybody making, owning, or talking about, any of the following: - editors that allow one to set tab width different from 1. - editors, compilers, and OSes that distinguish tabs from spaces in any way (display of invisible characters, search). - revision control systems that do not randomly replace spaces by tabs and vice versa in all text files.
- bnolsen 13y agoIf you used our coding style (haskell-ish) you would have no problems with tabs. Keep stuff logically towards the left to make quick scanning easier.
- binarycrusader 13y agoMost languages that are whitespace sensitive don't actually allow you to mix indentation. In fact, Python 2 will give you an error saying that a particular line doesn't match indentation level if it's a different number of spaces and 3 will give you a warning (and since warnings can be made into errors...).