More C programming questions ...
Rick Sivernell
res005ru
Thu Feb 17 16:49:56 PST 2005
On Thu, 17 Feb 2005 15:16:06 +0100
Roger Oberholtzer <roger at opq.se> wrote:
> On Tue, 2005-02-15 at 12:47 -0600, Rick Sivernell wrote:
>
> > All
> >
> > > > for (idx = 0 ; idx < numberitems ; idx++ )
> > {
> > gogetmydata( string ) ;
> > if (! strncmp( string, "ITEMID", 6) ) // less work for the compiler &
> > typing
>
> Less typing, but less obvious. If you read this, it would be 'if not
> strncmp...)', when what you really mean is 'if strncmp() says strings
> match'. Which For understandable maintainable code, I, personally, would
> do:
>
> #Define STRINGS_MATCH 0 // Maybe in an #include file I use all
> // the time
>
> If ( strncmp( string, "ITEMID", 6) == STRINGS_MATCH) { whatever }
>
> Granted this is a common function that would not confuse a programmer.
> But when the functions become less common, this is, IMHO, much better.
>
> All a matter of taste.
>
> --
> Roger Oberholtzer <roger at opq.se>
>
> _______________________________________________
> Linux-users mailing list
> Linux-users at linux-sxs.org
> http://mail.linux-sxs.org/cgi-bin/mailman/listinfo/linux-users
>
> Need to chat further on this subject? Check out #linux-users on
> irc.linux-sxs.org !
Roger
> All a matter of taste. << I agree, different stroke for different folks, <g>
--
Rick Sivernell
Dallas, Texas 75287
972 306-2296
res005ru at verizon.net
Registered Linux User
.~.
/ v \
/( _ )\
^ ^
In Linux we trust!
More information about the Linux-users
mailing list