On Wednesday 25 January 2006 11:29 pm, Philip M. Gollucci wrote:
> >- if(0 == strncasecmp(arg, "+inherit", 8)) {
> >+ if (0 == strncasecmp(arg, "+inherit", 8)) {
> > modperl_cmd_options(parms, mconfig, "+InheritSwitches");
> > }
> > else {
>
> Isn't the normal c idiom
> if (!strncasecmp(....) ?
> I don't think I've ever seen that form.... (though correct)
It's somewhat more common with C++. The logic is this:
if you typo:
if (var == 0) ...
as
if (var = 0) ...
it will compile, often without even a warning (though more recent versions of
gcc do complain), but not do what you expect and the bug can be very hard to
spot. However if you typo:
if (0 == var) ...
as
if (0 = var) ...
you'll get a compile time error, as you can't assign to a constant. So whilst
it reads strangely to most people, some get in the habit of using that form.
It wouldn't make a difference in this case, as far as I can tell though.
--
"I just think it's rather odd that a nation that prides itself on its virility
should feel compelled to strap on forty pounds of protective gear just in
order to play rugby."
- Giles, Buffy the Vampires Slayer: Some Assembly Required
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]