Re: Endian issues...final chapter

Jack, W8TEE
 

Totally agree when moving data between internet users. The downside is that binary 255 takes one byte but ASCII takes three bytes to push down a com link. If you are doing something computationally intensive, like moving FFT data to an SDR spectrum display, minimizing data transfer time can make a large performance difference. As Hans Summers (designer of the super-cool QCX transceiver from QRP Labs) pointed out, the endian issue must be handled even when writing to EEPROM on the same machine. You could store numeric data in EEPROM as ASCII, but then you need to pass through atoi() going into EEPROM and itoa() coming out. Clearly, Hans is storing his EEPROM data in binary.

CAT protocols like the one Ian Lee has worked on use an ASCII data transfer and it makes it so much easier to debug when something goes south. Even then, however, when commands can be as short as 10 bytes, someone reported a noticeable delay in response time. If you're only tool is a hammer, it should be no surprise that every problem looks like a nail. Binary versus ASCII protocols simply hangs a second tool on your belt. You need to decide which best solves your design problem.

Jack, W8TEE



From: Ashhar Farhan <farhanbox@...>
To: BITX20@groups.io
Sent: Sunday, March 11, 2018 12:49 AM
Subject: Re: [BITX20] Endian issues...final chapter

ietf solved this by insisting that internet protocos SHOULD be in plain text. it makes debuggera out our eyeballs and prevents testing of friendships.

On 11 Mar 2018 12:27 am, "Michael Hagen" <motdog@...> wrote:
If Push comes to Stack, who wins Big Injun or Little Injun?

On 3/10/2018 10:48 AM, Jerry Gaffke via Groups.Io wrote:
We agree that  "Endianness is a problem when a binary file created on a computer is read on another computer with different endianness."

Where we seem to disagree is that I am convinced this code will always prints a value of "4"
regardless of whether the machine is big or little endian:

  long data32;    int  data8;
  data32 = 0x04030201;
  data8 = data32>>24;
  printf("%d \n", data8);

From this, we can create the endian agnostic code at the top of post 44018.  
Arv is correct, this is not something most of you need to worry about.
I'm totally done here.
Unless you want to talk about Gulliver's Travels.

Jerry


On Sat, Mar 10, 2018 at 08:42 am, Jack Purdum wrote:
   Endianness is a problem when a binary file created on a computer is read on another computer with different endianness.
 

-- 
Mike Hagen, WA6ISP
10917 Bryant Street
Yucaipa, Ca. 92399
(909) 918-0058
PayPal ID  "MotDog@..."
Mike@...



Virus-free. www.avast.com

Join BITX20@groups.io to automatically receive all group messages.