Skip to contentSkip to conversation

what is with the "#if 0"ed part of ARP hdr in include/net.h?

U-Boot Robert P. J. Day 2 participants 2 messages Jul 17, 2016 – Jul 18, 2016

lore
Share & tools
lore
#0 lore raw

was poking around in include/net.h, and noticed this snippet:

/*
* Address Resolution Protocol (ARP) header.
*/
struct arp_hdr {

... snip ...

#define ar_sha          ar_data[0]
#define ar_spa          ar_data[ARP_HLEN]
#define ar_tha          ar_data[ARP_HLEN + ARP_PLEN]
#define ar_tpa          ar_data[ARP_HLEN + ARP_PLEN + ARP_HLEN]
#if 0
        u8              ar_sha[];       /* Sender hardware address      */
        u8              ar_spa[];       /* Sender protocol address      */
        u8              ar_tha[];       /* Target hardware address      */
        u8              ar_tpa[];       /* Target protocol address      */

#endif /* 0 */
};

i just checked, and that "#if 0" has been there since 2002:

2d966958 (Wolfgang Denk                    2002-10-31 22:12:35 +0000 421) #if 0
717234e0 (Sergey Temerkhanov               2015-04-08 01:41:23 -0500 422)       u8              ar_sha[];       /* Sender hardware address      */
717234e0 (Sergey Temerkhanov               2015-04-08 01:41:23 -0500 423)       u8              ar_spa[];       /* Sender protocol address      */
717234e0 (Sergey Temerkhanov               2015-04-08 01:41:23 -0500 424)       u8              ar_tha[];       /* Target hardware address      */
717234e0 (Sergey Temerkhanov               2015-04-08 01:41:23 -0500 425)       u8              ar_tpa[];       /* Target protocol address      */
2d966958 (Wolfgang Denk                    2002-10-31 22:12:35 +0000 426) #endif /* 0 */

is it doing anything, like acting as a comment or something?

rday

p.s. there's quite a lot of "#if 0" throughout the source code, some of which i may submit patches to get rid of just in the areas i'm confortable with.

Signature · 7 lines
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================
#1 lore raw

Dear "Robert P. J. Day",

Quoted 2 lines · In message <[email protected]> you wrote:

was poking around in include/net.h, and noticed this snippet:

...

Quoted 1 line

is it doing anything, like acting as a comment or something?

Probably. Sorry, I dont remember the details.

Quoted 3 lines

p.s. there's quite a lot of "#if 0" throughout the source code, some of which i may submit patches to get rid of just in the areas i'm confortable with.

In many cases this was used to create "minimal" diffs compared to the original code imported from elsewhere. Commenting a bigger block of code using "#if 0" was deemed to be easier to forward-port to new versions of the code than deleting the whole block, where any changes in this (uninteresting) code would cause conflicts.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
If the car industry behaved like the computer industry over the  last
30  years, a Rolls-Royce would cost $5, get 300 miles per gallon, and
blow up once a year killing all passengers inside.