🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Problema con los tipos en c

#1106
From: Pascal Bourguignon
Date: Wed, 17 May 2006 02:30
37 lines
2605 bytes
javi <xx@xx.net> writes:

> Hola
>
> He descargado el programa apetag desde aqu� http://muth.org/Robert/Apetag/ y
> al ejecutarlo encontr� que no funcionaba. Despu�s de mirar el c�digo fuente
> encontr� lo siguente:
>
> En la l�nea
>
> input.seekg ( -sizeof(APE_HEADER_FOOTER), ios::end );
>
> el valor de sizeof(APE_HEADER_FOOTER) es 32; pero con el signo menos se
> converte en 4294967264.
>
> Lo he solucionado de la siguiente forma:
>
> input.seekg ( (int) -sizeof(APE_HEADER_FOOTER), ios::end );
>
> pero no s� si es un bug del programa o de mi sistema (Debian testing). Os
> agradecer�a cualquier aclaraci�n y si consider�is necesario avisar al
> autor.

Bueno...  El tema es que sizeof puede retornar un size_t, y un size_t
puede ser unsigned int (o cualquier unsigned tipo).  
Asi que -(unsigned int)32 puede dar 4294967264.
Tambien, si lo pasas a un parametro signed int, puede volverse a -32...
Es lo que has hecho. Yo, escribir�a: -((signed int)sizeof(...)), si
input.seekg espera un signed int.

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

NOTE: The most fundamental particles in this product are held
together by a "gluing" force about which little is currently known
and whose adhesive power can therefore not be permanently
guaranteed.
Technical Details
Message-ID: <8764k5z8ku.fsf@thalassa.informatimago.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
References: <e4duqe$qh2$1@nsnmpen2-gest.nuria.telefonica-data.net>

Show Full Headers
Complete Article Headers
X-Google-Thread: f86c8,e07c9593e2ba0a83
X-Google-Attributes: gidf86c8,public
X-Google-Language: SPANISH,ASCII
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: Pascal Bourguignon <pjb@informatimago.com>
Newsgroups: es.comp.os.linux.programacion
Subject: Re: Problema con los tipos en c
Date: Wed, 17 May 2006 04:30:41 +0200
Organization: Informatimago
Lines: 37
Message-ID: <8764k5z8ku.fsf@thalassa.informatimago.com>
References: <e4duqe$qh2$1@nsnmpen2-gest.nuria.telefonica-data.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: individual.net OmBSoAWJXM+e7ZBGEbPCfQkAczpG302p89VufEVlXf/Rrexjlp
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA
      oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9
      033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac
      l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR
      mV+hO/VvFAAAAABJRU5ErkJggg==
X-Accept-Language:         fr, es, en
X-Disabled: X-No-Archive: no
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)
Cancel-Lock: sha1:EAsxrH79qpxqqiEkypfpK7jWO8c=