[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: OT Clean C standard?
- From: Pan Shi Zhu <pan.shizhu@...>
- Date: Fri, 25 Jun 2010 08:48:23 +0800
On Thu, Jun 24, 2010 at 9:29 PM, Rob Kendrick <rjek@rjek.com> wrote:
> On Thu, 24 Jun 2010 09:27:07 -0400
> Patrick <spell_gooder_now@spellingbeewinnars.org> wrote:
>
> Mostly, this is avoiding using things like "new" or
> "delete" as identifiers.
AFAIK there are many standard ANSI C features which is not in ANSI
C++98 standard.
to name a few:
1. use of VLA, that is, use an variable as array length, such as:
int do_somegthing(size_t a_len)
{
char str[a_len];
// ...
}
2. use of stdint.h, that is, int64_t, uint64_t, int32_t, int16_t,
int8_t, uint8_t types.
3. use of stdbool.h, which defines bool as an enum, while bool in C++
is keyword.
4. use of new-style variable argument macros such as ##__VA_ARGS__, for example:
#define log_trace(level,func,line,...) do { \
char s[BUFSIZ]; \
sprintf(s, ##__VA_ARGS__); \
syslog(level,"%s:%d %s", func, line, s); \
} while (0)
#define log_err(...)
log_trace(level_err,__FUNCTION__,__LINE__,##__VA_ARGS__)
The above is what I know, because I like those C features. but there
are plenty of other ANSI C features which is not is ANSI C++98 (may be
incorporated in C++0x).