O_oC supports a standard ABI that is used by multiple Compiler Vendors.
Elysia is correct.
There is no C standard ABI. Sometimes things will work out because the language is simpler. (You don't, for example, need mangling to account for overloading.) The ABI you are probably familiar with is one of a few common ABI mostly designed by hardware engineers. (A variation of the "Itanium" ABI is very common these days even in x8664 land.) Even then, the ABI you are familiar with only has so much conformance. (On x86, for example, different compilers use different "internal padding" for variables depending on the options. You might, same example, compile with some variation of "use double precision for all mathematics" changing the size of all structures with a `float' member. Depending on other compilers, you'll never be able to directly interface the compiled code because some compilers do not have options for aligning `double' to 96 bits while that is the standard for other compilers.) One you reach beyond default everything, the ABI gets less and less "standard".
Soma
“Salem Was Wrong!” -- Pedant Necromancer
“Four isn't random!” -- Gibbering Mouther
O_oBesides, many things such as name mangling can be part of the standard ABI, while lower level things such as calling convention may be part of the platform ABI.
If the standard mandated a particular mangling scheme, most vendors would not follow that part of the standard.
*shrug*
Face it, you aren't going to see a standard ABI which will be widely adopted for years and years if ever.
For a vendor, "backwards compatibility" would be more important than rigid adherence to the standard because clients expect a level of compatibility.
Soma
“Salem Was Wrong!” -- Pedant Necromancer
“Four isn't random!” -- Gibbering Mouther
So... Are we gonna all just ignore the fact that MILL architecture CPUs sounds absolutely astonishingly amazing? It's free performance boosts without code rewrites. I started watching the presentation on branching and I'm really starting to get into this. I mean, forget writing in assembly. Learning assembly in this day and age just seems silly unless you're either getting paid for it or you're getting paid a lot for it.
The speaker is also a perfect caricature of a computer scientist, imo. And I absolutely loved his joke, "Now, some of you younger folks may not recognize it but this is 'assembly language'."
They aren't instructions, he is specifically talking about assembly macros.
If you don't know what something is, don't pretend to follow along.Many assemblers support predefined macros, and others support programmer-defined (and repeatedly re-definable) macros involving sequences of text lines in which variables and constants are embedded. This sequence of text lines may include opcodes or directives. Once a macro has been defined its name may be used in place of a mnemonic. When the assembler processes such a statement, it replaces the statement with the text lines associated with that macro, then processes them as if they existed in the source code file (including, in some assemblers, expansion of any macros existing in the replacement text).
Note that this definition of "macro" is slightly different from the use of the term in other contexts, like the C programming language. C macros created through the #define directive typically are just one line, or a few lines at most. Assembler macro instructions can be lengthy "programs" by themselves, executed by interpretation by the assembler during assembly.
Since macros can have 'short' names but expand to several or indeed many lines of code, they can be used to make assembly language programs appear to be far shorter, requiring fewer lines of source code, as with higher level languages. They can also be used to add higher levels of structure to assembly programs, optionally introduce embedded debugging code via parameters and other similar features.
Link to the Wiki org page Rust (programming language) - Wikipedia, the free encyclopedia
Tim S.
"...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson
So, I'm currently looking through the Rust wiki and I have some comments/thoughts :
1. No null pointers is interesting to me though I'm sure other languages already have this
2. It's performance is expected to be similar to C++ with proper checking which means native versions of C++ are faster and a performant build of Rust would have to be "unsafe"
3. I like the functional style in the factorial examples and that if-else is an 'expression'
4. Things are automatically immutable so I don't see how time is saved or this is preferred over using 'const' in C/C++ because I have to declare 'mut' for everything I want changed
5. println() is no better than printf() and both are less useful in my mind than std::cout which just prints anything without me specifying
6. Spawning multiple threads is very similar to std::thread + lambdas
And I have to read more about the pattern matching and recursive data structure examples to understand them.
Yeah, once I discovered languages that don't have null I pretty much stopped being impressed by languages that didn't solve this problem. That's why I didn't like Dart: it's not doing enough to really replace JavaScript. It has all the null pointers, all the callback hell, it's just a small improvement that's not worth the investment to learn it.
Unlike D, Rust doesn't have "unsafe" builds that perform better. But you can write code that is marked trusted and the compiler assumes you know what you're doing. In other words, you either leave safety to yourself or the compiler. You'll have to use the more low level APIs explicitly.
In regards to const, 80% of all variables are used once and only once. What's the point of marking 80% of your variables const when you can just mark 15% of your variables mut? (The other 5% are never used)
println! macro is better than printf because it won't compile when you have the wrong amount of arguments, while printf will barf at runtime
Not to make a mountain out of a molehill, but:
I think rust is just different in terms of const. I have heard that every variable is constant until proven otherwise, but in C/C++, most variables are not const because they must have a useful, immutable value when they are defined. Most programs transform input in some way. Why would I want to declare all of my variables with human input or otherwise mut when they most likely always need to be modified at least once? Most of the examples do not show why this design choice is helping anybody.
if you are compiling such that printf() is not being checked, then you are doing it wrong. You aren't supposed to compile with warnings turned off. That is basic stuff.
Last edited by whiteflags; 06-23-2014 at 03:18 AM.
to the contrary, most variables are something like
and then laterCode:ui_inputSpinBox1 = findChild<QSpinBox*>("inputSpinBox1");
so you assign something, use it once and you're doneCode:ui_outputWidget->setText(QString::number(value + ui_inputSpinBox2->value()));
this is 80% of all variables according to research