This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
There's a difference in
void send_float (float foo, int fd) { write (fd, &foo, sizeof (float)); }
and
void send_float (float foo, int fd) { char buf[100]; snprintf (buf, sizeof (buf), "%f", foo); write (fd, buf, strlen (buf)); }
The second variant surely burns more CPU cycles, even on both sides, but it'll easily work even for different architectures. (I just think about VAX where the CPU FP support is made up of four non-IEEE float types...)
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |