lkml.org 
[lkml]   [1999]   [Feb]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRedirect: Q: void* vs. unsigned long
Greetings,

I'm sorry for starting such a confused thread; it is obvious from some of
the responses that there are many out there who are more confused than I am
about the void*/unsigned long issue in Linux. :)

To redirect away from discussions about sizes of longs verses pointers, C
specs, old hardware or 64-bit machines (I'm Linux/AXP, btw), I wanted to
expose and question the underlying practice of casting pointers from
"unsigned long" in platform-independant pieces of the kernel (eg. timer
queues).

Was it HPA that mentioned the idea of using a union to hide the details? I
thought it was a great idea. There was another person who responded with
the enlightening point of needing to do integer arith on pointers in the
kernel (sorry, I don't recall names; I'm just catching up on my email) for
mm tricks or some such.

The real reason I asked is because I am working on a project that does
asynchronous encryption of IPSec packets via an interrupt-driven protocol
accelerator driver (http://www.rainbow.com) and debated very long about
whether to use void* or unsigned long in the callback argument. The only
reason I considered the unsigned long method was after reading the section
on timer queues in Rubini's "Linux Device Drivers". Perhaps there is a
better alternative to these "integral pointer" objects.

BTW, seems there was much confusion over the difference between C types and
word sizes, such as "long" and "longword".

cheers,
-bp
--
B. James Phillippe . bryan@terran.org
Software Engineer, WGT Inc. . http://www.terran.org/~bryan



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

\
 
 \ /
  Last update: 2005-03-22 13:50    [W:0.070 / U:1.632 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site