[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
 

Re: [CPROG] name space



On Thu, 24 May 2001 16:53:13 +0200,
Egon Andersen, Talura <sslug@sslug> wrote:

>Hej,
>
>Jeg har et problem med 'name space' i 'C'.
>Eksempel:
>
>struct Alpha
>  {
>  struct Beta
>    {
>    int a;
>    int b;
>    } beta;
>  } alpha;
>
>struct Gamma
>  {
>  struct Beta
>    {
>    char c;
>    char d;
>    } beta;
>  } gamma;
>
>Dette giver konflikt, da Beta indgår i både Alpha og Gamma.
>
>Findes der en måde at omgås dette problem med 'name space' på, hvor jeg
>altså kan bibeholde 'tag' Beta og Beta opfattes som to forskellige
>strukturer?
>Og aller helst vil jeg gerne kunne lave en pointer til den nestede
>struktur Beta afhængig af om den indgår i Alpha eller Gamma.
>Altså lidt i stil med:
>
>struct Gamma.Beta * myptr; /* Ugyldig, men illustrerer ideen */ 
>
>(Når dette er interessant og jeg ikke bare giver dem to forskellige
>navne, så skyldes det, at 'C' strukturerne skal genereres automatisk af
>et værktøj, udfra et input i et sprog, hvor dette kan forekomme.)

En løsning ville være at kalde den ene Beta for Alpha_Beta og den anden
for Gamma_Beta.

-- 
Anders Bo Rasmussen          mailto:sslug@sslug
Frimestervej 42 1.tv         http://www.fuzz.dk
2400 Kbh. NV
Denmark


 
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] *