🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.os.linux.programacion
Article #15302

Re: include's y struct's

#15302
From: quasimodo_TEM
Date: Sun, 16 Jul 2000 00:00
46 lines
1671 bytes
Expres�base as� "Julio Baixauli" el Thu, 29 Jun 2000 17:17:07 +0200:


>
>	�Se puede definir un struct en un .h y usar ese tipo en un .c
>(incluyendo el .h) ?

Claro

>	Otra pregunta: �Hay alg�n error en la siguiente definici�n? :
>
>
>
>struct my_libnet_ip6_hdr
>{
>	u_char    ip6_class:4,
>                  ip6_ver:4;
>
>        u_int     ip6_flow:24;		// 4 bits class, 20 bits flow label
>
>	u_short   ip6_paylen; 		// length excluding this header
>	u_char    ip6_nh; 			// next header, e.g. IPPROTO_TCP
>        u_char    ip6_hl;			// hop-limit, effectively equivalent to ttl
>
>        struct in6_addr ip6_src, ip6_dst;
>};                     ^
                    (aqu� una coma)
		    
Me parece un poco raro eso de usar comas en campos de bits:

    u_char ip6_class:4,
           ip6_ver:4;

Yo pondr�a el tipo en ambos casos:

    u_char ip6_class: 4;
    u_char ip6_ver: 4;
    

Y aparte de eso... nada m�s.

-- 
En teor�a no hay diferencia entre Teor�a y Pr�ctica... 
... pero en la pr�ctica s� suele haber diferencia.

(R. A. Pease)
Technical Details
Message-ID: <slrn8n477b.168.kuskihhhh@kurrink.etxean.org>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <395B6872.BB4DE159@mat.upc.es>

Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII
X-Google-Thread: f86c8,ed6ce95082faaceb
X-Google-Attributes: gidf86c8,public
From: kuskihhhh@hhhheuskalnet.net (quasimodo_TEM)
Subject: Re: include's y struct's
Date: 2000/07/16
Message-ID: <slrn8n477b.168.kuskihhhh@kurrink.etxean.org>
X-Deja-AN: 647364003
Content-Transfer-Encoding: 8bit
References: <395B6872.BB4DE159@mat.upc.es>
Organization: escasa o nula
Content-Type: text/plain; charset=iso-8859-15
User-Agent: slrn/0.9.5.7 (UNIX)
Mime-Version: 1.0
Newsgroups: es.comp.os.linux.programacion