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]....
>>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:
Anonymous2009-03-24 12:43
>>11
Good Idea. I'll check it! Have you got some interesting pointers?
>>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:
Anonymous2009-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:
Anonymous2009-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:
Anonymous2009-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?
>>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:
Anonymous2009-03-25 16:08
>>27
Endianness issues are not relevant unless you're programming on Macs.
>>31 EXPERT READING COMPREHENSION I smirked. Good one.
Name:
Anonymous2009-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:
Anonymous2009-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.
>>42
The OP's posts have been the least interesting parts of this thread by far. Threads don't exist in function of their first post.
Name:
Anonymous2009-03-26 10:38
I agree with >>45-san. Threads should end of their own volition.
Name:
Anonymous2009-03-26 11:12
Also, if you close a thread as soon as the question is answered, that eliminates the possiblity that someone else can contribute a better answer to the question later.
>>50
Have you considered using four spaces for indentation? It helps for readability.
Name:
Anonymous2009-03-26 20:42
>>51
Actually, numerous academic papers have been written on the subject and extensive research has been held. All such research and papers have pointed towards two spaces being the optimal indentation amount with regards to code readability, with a small number claiming three.
>>28
...macs or embedded systems. And that's me. Actually endianness *do* have importance.
However, I'm not afraid of endianness. I'm just asking about structs. Ok, thanks for who replied me telling that structs are not usable for my goals, but actually I'm searching for a precise document that declares them as not standard.
Does it exist?
Name:
Anonymous2009-03-27 9:33
>>66
It's no a c thing - it's related to the underlying architechure your working with, which the c compiler will have to fit with that. Some machines require things to be aligned on 32-bit boundaries for example, so a struct such as:
struct foo {
char foo1;
int foo2;
};
will end up padded with a 3 byte gap between foo1 and foo2.
>>57
It is pretty telling that the GNU coding standards are the ugliest known to man, and that they are official because they're RMS' personal preference. Is there anything about that man that is not pig disgusting?
>>75
No, that's what I meant. Just because the population are ignorant of some issues does not make those issues irrelevant. Take the work on sub-atomic theory for example. It was just a bunch of geeks that messed around with some useless theory right? I mean, we would have invented the microwave and nuclear energy without that knowledge right?
>>79
Yeah, I do admit the example is terrible. How about the strategy of resource conservation; just because many people can afford to finance a wasteful lifestyle doesn't mean they should. Some smart people took the initiative to educate the rest of society to take responsibility for our consumption of the Earth's resources. If we don't, our global society will literally lose everything in no time at all.
To imagine an outcome of society collapse on a global scale as a result of unrestricted resource consumption requires a fair amount of intelligence and foresight that wouldn't exist in the 1900's.
Likewise, most people have an elementary understanding of what RMS's message and fail to understand his deeper points as well as the implications of them. RMS has consistently shown to be correct as a thinker far beyond his time and people fail to understand his message because of plain ignorance.