PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.c > Re: About little big endian in C
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Re: About little big endian in C

Réponse
 
LinkBack Outils de la discussion
Vieux 20/10/2007, 13h31   #1
Charlie Gordon
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: About little big endian in C

"Kenneth Brody" <kenbrody@spamcop.net> a écrit dans le message de news:
470BBAEF.94FC0D04@spamcop.net...
> user923005 wrote:
> [...]
>> 20.9: How can I determine whether a machine's byte order is big-
>> endian
>> or little-endian?
>>
>> A: One way is to use a pointer:
>>
>> int x = 1;
>> if(*(char *)&x == 1)
>> printf("little-endian\n");
>> else printf("big-endian\n");
>>
>> It's also possible to use a union.
>>
>> See also question 10.16.
>>
>> References: H&S Sec. 6.1.2 pp. 163-4.

>
> I supposed that, techincally, the answer is incomplete at best.
> What happens on sizeof(char)==sizeof(int) systems? (And, on such
> systems, is "endianness" even relevent?)
>
> Then there are systems with some horrible mixed-endianned storage,
> where the 32-bit value 0x11223344 would be stored: 22 11 44 33.
> (Or is it 33 44 11 22?)


None still in production. You are refering to some PDP systems from more
than 30 years ago.

--
Chqrlie.


  Réponse avec citation
Vieux 20/10/2007, 20h42   #2
Keith Thompson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: About little big endian in C

"Charlie Gordon" <news@chqrlie.org> writes:
> "Kenneth Brody" <kenbrody@spamcop.net> a écrit dans le message de news:
> 470BBAEF.94FC0D04@spamcop.net...

[...]
>> Then there are systems with some horrible mixed-endianned storage,
>> where the 32-bit value 0x11223344 would be stored: 22 11 44 33.
>> (Or is it 33 44 11 22?)

>
> None still in production. You are refering to some PDP systems from more
> than 30 years ago.


I'll bet there are still a few PDP-11s in production use.

--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
  Réponse avec citation
Vieux 21/10/2007, 08h11   #3
Charlie Gordon
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: About little big endian in C

"Keith Thompson" <kst-u@mib.org> a écrit dans le message de news:
ln7ilh1sl0.fsf@nuthaus.mib.org...
> "Charlie Gordon" <news@chqrlie.org> writes:
>> "Kenneth Brody" <kenbrody@spamcop.net> a écrit dans le message de news:
>> 470BBAEF.94FC0D04@spamcop.net...

> [...]
>>> Then there are systems with some horrible mixed-endianned storage,
>>> where the 32-bit value 0x11223344 would be stored: 22 11 44 33.
>>> (Or is it 33 44 11 22?)

>>
>> None still in production. You are refering to some PDP systems from more
>> than 30 years ago.

>
> I'll bet there are still a few PDP-11s in production use.


Sorry, I meant none still being produced (manufactured) today.
PDP-11s in working order are worth some money for museums and collectors ;-)

--
Chqrlie.


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 20h37.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,08625 seconds with 11 queries