public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: jason.hobbs at calxeda.com <jason.hobbs@calxeda.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/3] net: Adds Fast Ethernet Controller driver for Armada100
Date: Mon, 22 Aug 2011 13:19:04 -0500 (CDT)	[thread overview]
Message-ID: <1314037144.33547007@apps.rackspace.com> (raw)
In-Reply-To: <201108221311.35824.vapier@gentoo.org>

On Monday, August 22, 2011 12:11pm, "Mike Frysinger" <vapier@gentoo.org> said:

> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
> On Monday, August 22, 2011 12:45:06 Marek Vasut wrote:
>> On Monday, August 22, 2011 06:42:33 PM Mike Frysinger wrote:
>> > On Monday, August 22, 2011 12:07:26 Marek Vasut wrote:
>> > > On Monday, August 22, 2011 06:02:26 PM Mike Frysinger wrote:
>> > > > On Monday, August 22, 2011 01:11:57 Ajay Bhargav wrote:
>> > > > > +	darmdfec = malloc(sizeof(struct armdfec_device));
>> > > >
>> > > > sizeof(*darmdfec)
>> > >
>> > > Why are you against sizeof(struct ...) ?
>> >
>> > imo, it holds up against bit rot easier and the code is clearer
>>
>> OTOH, you don't have to look up what type of ptr it is if you use struct
>> ...
> 
> i dont see how that's generally relevant.  if you want to know what the type
> of a variable is, you look for its definition.  i dont go looking for alloc
> related funcs on the off chance that someone explicitly wrote out the type.

There was a big thread on this on lkml long ago.

http://kerneltrap.org/node/5688

I prefer the inference of sizeof(*p) and think sizeof(struct blah) is a
violation of DRY, but it's not a huge issue to me and I can go either way.

I've been called out by Wolfgang for using sizeof(*p) in some code but not in
other code. It would be nice if there were some consistent recommendation for
new code here, documented in the U-boot coding style wiki.

Jason

  reply	other threads:[~2011-08-22 18:19 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-22  5:11 [U-Boot] [PATCH 1/3] net: Adds Fast Ethernet Controller driver for Armada100 Ajay Bhargav
2011-08-22 12:53 ` Marek Vasut
2011-08-23  5:31   ` Ajay Bhargav
2011-08-23  6:11   ` Ajay Bhargav
2011-08-23 10:33     ` Marek Vasut
2011-08-23 10:29       ` Ajay Bhargav
2011-08-23 11:06         ` Wolfgang Denk
2011-08-23 11:41           ` Ajay Bhargav
2011-08-23 12:59           ` Ajay Bhargav
2011-08-23 13:34             ` Wolfgang Denk
2011-08-23 15:30               ` Ralph Metzler
2011-08-23 17:21                 ` Mike Frysinger
2011-08-23 17:43                 ` Wolfgang Denk
2011-08-24  5:09               ` Ajay Bhargav
2011-08-22 16:02 ` Mike Frysinger
2011-08-22 16:07   ` Marek Vasut
2011-08-22 16:42     ` Mike Frysinger
2011-08-22 16:45       ` Marek Vasut
2011-08-22 17:11         ` Mike Frysinger
2011-08-22 18:19           ` jason.hobbs at calxeda.com [this message]
2011-08-23  5:36   ` Ajay Bhargav

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1314037144.33547007@apps.rackspace.com \
    --to=jason.hobbs@calxeda.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox