[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Et C spørgsmål især om pointere



Hvis nu man har noget i den her stil:

----------
struct a_t 
{
  bladr bladr...              /* ligemeget */
  unsigned long hostdata[0];  /* Huh? 0 Bytes? */
};

a_t * a = malloc(sizeof(a_t) + sizeof(void *)); /* + noget */

a->hostdata = malloc(sizeof(struct gufle));
---------

Giver ovenstående mening, altså er a->hostdata overhovedet en lvalue?,
Eller skulle det snarere være noget i den her stil:

*((void *)&(a->hostdata)) = malloc ... 

Og, er der så forskel på de her statements:

--------

gufle * p;
a) p   = (struct gufle *) a->hostdata
b) p   = (struct gufle *) ( (void *) a->hostdata);
c) tmp = (void *) a->hostdata; p = (struct gufle *) tmp;
--------

Vel egentlig, er der forskel på, når a->hostdata bruges som rvalue, 

a->hostdata 
*((void *)&(a->hostdata)) 

? Jeg er rimeligt forvirret.... :-/

Koden stammer til dels fra Linux kerne scsi laget.
 
Al hjælp værdsættes.

Mads

-- 
Mads Bondo Dydensborg.                               sslug@sslug
Estimates of online gamers in the United States alone run as high as 15 to
20 million people. 
                                      - Jon Katz, Slashdot, on youth culture.





 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:08 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *