lkml.org 
[lkml]   [2004]   [Sep]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Being more anal about iospace accesses..
Jörn Engel wrote:
> On Wed, 15 September 2004 09:30:42 -0700, Linus Torvalds wrote:
>
>>For example, if you don't know (or, more importantly - don't care) what
>>kind of IO interface you use, you can now do something like
>>
>> void __iomem * map = pci_iomap(dev, bar, maxbytes);
>> ...
>> status = ioread32(map + DRIVER_STATUS_OFFSET);
>
>
> C now supports pointer arithmetic with void*? I hope the width of a
> void is not architecture dependent, that would introduce more subtle
> bugs.
>
> Jörn
>

http://gcc.gnu.org/onlinedocs/gcc-3.4.2/gcc/Pointer-Arith.html#Pointer-Arith

5.18 Arithmetic on void- and Function-Pointers

In GNU C, addition and subtraction operations are supported on pointers
to void and on pointers to functions. This is done by treating the size
of a void or of a function as 1.

A consequence of this is that sizeof is also allowed on void and on
function types, and returns 1.

The option -Wpointer-arith requests a warning if these extensions are used.

--
Brian Gerst
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:06    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site