Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* naive GDB programming style questions
@ 2002-09-09 16:14 David Carlton
  2002-09-09 18:45 ` Andrew Cagney
  2002-09-10  8:56 ` Tom Tromey
  0 siblings, 2 replies; 7+ messages in thread
From: David Carlton @ 2002-09-09 16:14 UTC (permalink / raw)
  To: gdb

1) It seems to me that some parts of GDB's source use NULL while other
   parts use 0.  Is one or the other of these generally preferred?

2) Am I correct in observing that GDB frowns on code like the
   following:

     char *p = calculate_p ();

     if (!p)
       p_is_zero ();

   preferring this instead?

     char *p = calculate_p ();

     if (p == NULL)
       p_is_zero ();

   Does it matter that p in a pointer rather than an integer, or that
   the code is testing for zeroness rather than nonzeroness?

3) Is it possible to get CC Mode to indent in the way that GDB seems
   to prefer?  I'm having a hard time getting structs to be indented
   as follows:

     struct foo
       {
         int mem;
       };

   without screwing up my preferred indentation when doing non-GDB
   programming, namely

     struct foo {
       int mem;
     };

   Of course, I can write functions to toggle between the two; but
   given that both styles seem to be able to coexist for enums, maybe
   it's possible to get them to coexist for enums.  (I'm certainly no
   CC Mode expert...)

David Carlton
carlton@math.stanford.edu


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2002-09-12 18:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-09 16:14 naive GDB programming style questions David Carlton
2002-09-09 18:45 ` Andrew Cagney
2002-09-09 20:52   ` David Carlton
2002-09-10 11:39     ` David Carlton
2002-09-10 16:15       ` Andrew Cagney
2002-09-12 11:35     ` Andrew Cagney
2002-09-10  8:56 ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox