On Sun, Apr 17, 2005 at 03:05:43PM -0700, Nathaniel Smith wrote:
... it helps if your existing guess_binary function
doesn't contain a C-style string of characters that imply binary, of
which the first element is NUL ;-)
Who would use a null-terminated string for anything in a C++ program?
Here's a handy idiom:
template unsigned N
int f(const char (a)[N])
{ return ::write(1, a, N-1); }
int main() { return f(abc\n); }
The template engine deduces the size of the literal string and binds N
to that value, so you don't need to search for any dumb terminator.
Better yet, if you call f with a pointer, the compiler rejects it.
Nathan Myers
[EMAIL PROTECTED]
___
Monotone-devel mailing list
Monotone-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/monotone-devel