[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Monotone-devel] Two new lists to get commit logs
From: |
Nathan Myers |
Subject: |
Re: [Monotone-devel] Two new lists to get commit logs |
Date: |
Sun, 17 Apr 2005 16:25:30 -0700 |
User-agent: |
Mutt/1.3.28i |
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
address@hidden
- [Monotone-devel] Two new lists to get commit logs, Richard Levitte - VMS Whacker, 2005/04/13
- Re: [Monotone-devel] Two new lists to get commit logs, Derek Scherger, 2005/04/14
- Re: [Monotone-devel] Two new lists to get commit logs, Richard Levitte - VMS Whacker, 2005/04/14
- Re: [Monotone-devel] Two new lists to get commit logs, Nathaniel Smith, 2005/04/15
- Re: [Monotone-devel] Two new lists to get commit logs, Richard Levitte - VMS Whacker, 2005/04/15
- Re: [Monotone-devel] Two new lists to get commit logs, Florian Weimer, 2005/04/17
- Re: [Monotone-devel] Two new lists to get commit logs, Nathaniel Smith, 2005/04/17
- Re: [Monotone-devel] Two new lists to get commit logs,
Nathan Myers <=
- Re: [Monotone-devel] Two new lists to get commit logs, Florian Weimer, 2005/04/18
- Re: [Monotone-devel] Two new lists to get commit logs, Asger Alstrup, 2005/04/15
Re: [Monotone-devel] Two new lists to get commit logs, Florian Weimer, 2005/04/18