Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C Structs

Name: Anonymous 2009-03-24 12:22

Hi fags.

I need to know how portable c structs are for data transmission: are the fields in a fixed position determined by some standard?

Name: Anonymous 2009-03-24 12:24

No.

Name: Anonymous 2009-03-24 12:27

Use packed structures

Name: Anonymous 2009-03-24 12:29

>>1-3
SPAWHBTC

Name: Anonymous 2009-03-24 12:32

Actually there must be something not portable... and that's demonstrated by tinyos documentation

These structures MUST be external structs (nx_struct), and all of their fields MUST be external types (nx_*), for two reasons. First, external types ensure cross-platform compatibility [1]....

Name: Anonymous 2009-03-24 12:33

>>3

OP speaking: what's that?

Name: Anonymous 2009-03-24 12:33

>>5
Cargo cult programming is fun.

Name: Anonymous 2009-03-24 12:35

>>6

It's SHOW SOME ADAPTABILITY YOU FAGTARD.

Name: Anonymous 2009-03-24 12:35

>>7

wut

Name: Anonymous 2009-03-24 12:37

NO

Name: Anonymous 2009-03-24 12:42

>>9
Instead of taking confused cues from the documentation of some random project which may or may not have shit to do with anything, you could try reading the goddamn C standard.

Name: Anonymous 2009-03-24 12:43

>>11
Good Idea. I'll check it! Have you got some interesting pointers?

Name: Anonymous 2009-03-24 12:54

>>12
void* is a pretty good one.

Name: Anonymous 2009-03-24 12:57

>>13
Well, shit.

Name: Anonymous 2009-03-24 12:58

>>12
 NullPtr

Name: Anonymous 2009-03-24 13:02

>>15
That's funny.

Name: Anonymous 2009-03-24 13:05

ぬるぽ

Name: Anonymous 2009-03-24 13:06

>>13
You mean void *.

Name: Anonymous 2009-03-24 13:12

Serialization Serialization Serialization

Name: Anonymous 2009-03-24 16:28

>>18
If C's tokenizer were sane, that's what I'd mean. However it has no requirement that tokens must have whitespace in between.

Name: Anonymous 2009-03-24 19:42

The proper way is to marshal the data manually into the stream. You should really treat a struct has a local thing only.

Name: Anonymous 2009-03-24 20:31

>>21
No. The language is there for a reason, not so you can do extra work when you don't need to.

Name: Anonymous 2009-03-24 20:40

>>22
No. The language is there for a reason, not so you can do extra work when you don't need to.
Did you forget this thread was about C somewhere in the heat of the argument?

Name: Anonymous 2009-03-24 22:03

>>23
No.

Name: Anonymous 2009-03-25 15:33

>>1
They aren't. Use XDR.

Name: Anonymous 2009-03-25 15:52

Use a JSON parser
Thread over

Name: Anonymous 2009-03-25 15:56

>>22
What about endianess if the struct contains multi-byte integers? Will the language just magically get it right when sending, or does one have to ensure that it's converted correctly?

Name: Anonymous 2009-03-25 16:08

>>27
Endianness issues are not relevant unless you're programming on Macs.

Name: Anonymous 2009-03-25 16:10

>>28
I stopped reading at "unless." Nobody cares about Macs.

Name: Anonymous 2009-03-25 16:30

>>28
WORST TROLL OR WORSTEST TROLL

Name: Anonymous 2009-03-25 16:32

>>29
How do you know he was talking about Macs unless you continued reading?

Name: Anonymous 2009-03-25 16:34

>>30
WORCHESTERSHIRE TROLL

Name: Anonymous 2009-03-25 16:42

>>28
>Endianness issues are not relevant unless you care about portability.

Fix'd that for you.

Name: Anonymous 2009-03-25 16:43

>>31
EXPERT READING

Name: Anonymous 2009-03-25 17:03

>>31
EXPERT READING COMPREHENSION
I smirked. Good one.

Name: Anonymous 2009-03-25 17:03

Actually it's obvious that little-endian is the superior byte ordering. Since new Macs are little-endian too, you should stop caring and declare forced obsolescence over anything big-endian.

Are the PPC chips in the PS3 and X360 big or little endian? If they are big endian, it's no surprise the former is overpriced and doesn't sell and the later crashes as much as it does.

Name: Anonymous 2009-03-25 17:08

>>36
What the fuck does endianness have to do with the price or stability of a processor? It's just a design decision. In fact, many processors can be either big- or little- endian.

It's not like converting endianness is hard, anyways, it's just something you have to remember to do.

I will admit that little-endian, although at first unintuitive, does have some great benefits. For example, it's easier to convert larger integers to smaller ones in a little-endian system.

Name: Anonymous 2009-03-25 17:12

>>37
Endianess is relevant because of YHBT

Name: Anonymous 2009-03-25 17:54

>>27
Why would you need multibyte integers anyway? They are a solution in search of a problem.

Name: Anonymous 2009-03-25 19:43

>>37
I will admit that little-endian, although at first unintuitive
You've obviously never used assembler. Ever.

does have some great benefits.
Big-endian has exactly one, and it's not "great".

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List