TinySSH is a small SSH server using NaCl, TweetNaCl
61–64 of 64 posts
Re: TinySSH is a small SSH server using NaCl, TweetNaCl
#62Earlier quoted context omitted.
Microsoft's poor support for standard C is no excuse not to use these types everywhere else and either define them yourself on windows or get stdint from boost, from one of the stdint.h replacements or from MSVC 2012. IMHO, of course.
I hate Microsoft as much as the next guy, but FYI, MSVC 2013 supports most of C99.
* no variable-length arrays
* no qualifiers in parameter array declarators (`int x[static 10]`, etc.)
* no `restrict` keyword
* no compound literals
* no designated initializers
There's probably more.
On the web you'll find the same quote copy & pasted over and over saying that support for compound literals and designated initializers was supposedly added in VS2013, but it does not appear to be true. Either that, or I haven't found the hidden switch to enable it. By the way, C code still needs to be compiled as C++ to get anything beyond C89 to work, which should give you a clue as to how serious Microsoft is about C99.
What's true though is that stdbool.h was added. It's a start, I guess...
Re: TinySSH is a small SSH server using NaCl, TweetNaCl
#63Earlier quoted context omitted.
What do they leave to be desired? Style is a personal preference, of course - but merit? Every single djb implementation I've seen (a lot of them) is fast, efficient, secure, and clear, once you get his style.
Mostly his disregard for packaging conventions and unwillingness to acomodate them. The code is usually A grade, but the odd use of the filesystem, runtime configs, daemons etc. means it will never get into any mainstream distro without heavy patching. There's a reason why libsodium's tag line is "P(ortable|ackageable) NaCl-based crypto library". The word of distros/packagers isn't gospel, but it counts for a lot, co…
Re: TinySSH is a small SSH server using NaCl, TweetNaCl
#64How is code like below "easily auditable"? keydir = *++argv; if (!keydir) die_usage(); or if (*x == 'v') { if (flagverbose >= 2) flagverbose = 3; else flagverbose = 2; continue; } why put multiple statements on the same line if you have nothing to hide?[1] [1] https://www.kernel.org/doc/Documentation/CodingStyle
> why put multiple statements on the same line if you have nothing to hide? Because it's more readable. Do you truly find having only a few words per line more readable? Does it aid with comprehension? I find having a high word density to be the most "readable", and it doesn't seem to matter whether it's C or English. The TinySSH source code is small enough that I was able to read it in about 25 minutes and I learned…
that being said,
breaking a sentence across multiple lines
does help with comprehension
when you break on clause boundaries.