WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Xen

xen-devel

[Top] [All Lists]

Re: [Xen-devel] Re: [PATCH 2.6.12.6-xen] sysfs attributes for xen

To: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Subject: Re: [Xen-devel] Re: [PATCH 2.6.12.6-xen] sysfs attributes for xen
From: Dave Hansen <haveblue@xxxxxxxxxx>
Date: 2006年1月30日 09:56:53 -0800
Cc: Greg KH <greg@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx, lkml <linux-kernel@xxxxxxxxxxxxxxx>, "Mike D. Day" <ncmike@xxxxxxxxxx>
Delivery-date: 2006年1月30日 18:06:48 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <26c21a6abef89d4629a0da08bc0ba9bf@xxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <43DAD4DB.4090708@xxxxxxxxxx> <1138637931.19801.101.camel@xxxxxxxxxxxxxxxxxxxxx> <43DE45A4.6010808@xxxxxxxxxx> <1138640666.19801.106.camel@xxxxxxxxxxxxxxxxxxxxx> <43DE4A1D.4050501@xxxxxxxxxx> <1138642737.22903.14.camel@xxxxxxxxxxxxxxxxxxxxx> <26c21a6abef89d4629a0da08bc0ba9bf@xxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Mon, 2006年01月30日 at 17:53 +0000, Keir Fraser wrote:
> On 30 Jan 2006, at 17:38, Dave Hansen wrote:
>
> > Yes, they are. Buuuuuuut, you _can_ make the code around them a little
> > less evil. If you _must_ use a typedef, you could do something like
> > this:
> >
> > #define XEN_CAP_INFO_LEN_BYTES 1024
> > typedef char [XEN_CAP_INFO_LEN_BYTES] xen_capabilities_info_t;
>
> Is that really better than just referencing the typedef? I've always 
> considered them okay for simple scalar and array types, even if they 
> are to be avoided for structure types.
One reason they're "evil" is that they hide what is going on. It is
worse for structures, but doing it for arrays still hides what is there,
and a hapless programmer can easily jump off the end of the stack
without realizing it. I think the kernel style is to be as explicit as
possible, especially when it isn't too verbose.
In this case, I expect a programmer declaring a 'char foo[XEN_FOO]'
array on the stack to be much more likely to go look up how big XEN_FOO
is than one who sees a 'xen_capabilities_info_t foo'.
> Is it the size aspect that is 
> the problem (e.g., a typedef'ed type should be okay to allocate on the 
> stack)?
The size is the issue. A typedef just makes it a little bit harder to
track down. That's why typedefs are evil. ;)
-- Dave
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
Previous by Date: Re: [Xen-devel] Error with Debian Sid and Xen 3 , Ralph Passgang
Next by Date: Re: [Xen-devel] Trying out photography.... , Molle Bestefich
Previous by Thread: Re: [Xen-devel] Re: [PATCH 2.6.12.6-xen] sysfs attributes for xen , Keir Fraser
Next by Thread: Re: [Xen-devel] Re: [PATCH 2.6.12.6-xen] sysfs attributes for xen , Greg KH
Indexes: [Date] [Thread] [Top] [All Lists]

Copyright ©, Citrix Systems Inc. All rights reserved. Legal and Privacy
Citrix This site is hosted by Citrix

AltStyle によって変換されたページ (->オリジナル) /