|
Sometimes that doesn't matter. Sometimes you're writing software dedicated to a particular microcontroller and it expects the thing to be wired a certain way in order to run anyway.
Real programmers use butterflies
|
|
|
|
|
oh well.. yes if consumer and producer is the same one, I guess it's all good!
|
|
|
|
|
I've read this subject line several times now, wanting to point out what's so wrong with it.
Anyway, I think you will love Javascript.
Wrong is evil and must be defeated. - Jeff Ello
Never stop dreaming - Freddie Kruger
|
|
|
|
|
There's a special place in programmer hell for whoever came up with duck typing.
Real programmers use butterflies
|
|
|
|
|
I have been using C for+/- 32 years and still like it a lot.
The fact that yes, you can do anything, does force you to be very careful what you ask for because you will get it.
|
|
|
|
|
It's very satisfying to be back to it after being confined to coding in C# so much.
Real programmers use butterflies
|
|
|
|
|
You could always use a union, no need to even cast then (:
I wouldn't want to program in C targeting a PC these days; but it is good for 8 & 16 bit embedded work, where you need to get at hardware registers and only have maybe 2K RAM and 16K or 32K ROM.
|
|
|
|
|
I'm coding a microcontroller and technically I'm using C++ but barely because I am avoiding templates and the STL. =(
Real programmers use butterflies
|
|
|
|
|
If you were using fwrite, you wouldn't even need a cast...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Quote: I love C where types are basically a suggestion rather than a rule
That doesn't sound like C. The only place in C where types are not enforced are in void pointers. Everywhere else you have to literally force the compiler to accept incorrect types.
How is this different from other languages?
|
|
|
|
|
You misunderstand me.
I'm not saying C doesn't enforce types.
I'm saying if you want to change the type it's enforcing you just have to give it a little nudge.
For example
struct S {
int x;
int y;
};
...
S s;
s.x=1;
s.y=1;
byte* bp = (byte*)&s;
Real programmers use butterflies
|
|
|
|
|
Quote: byte* bp = (byte*)&s;
That's a bug :-/. C does not allow conversion of pointers to anything other than a void pointer and back again. A compiler may let you do it but the language standard calls it a bug (undefined behaviour).
In other words, that isn't correct C; many compilers will allow it and let the program produce unpredictable results (anything from producing the correct results, producing incorrect results, all the way to crashing).
The correct way to do that is to use a union, at which point the strong typing gets enforced and alignment is guaranteed and you have not broken any of the C standards rules. While this way isn't Undefined Behaviour, it's not fully defined either - it's Implementation Defined (someone will correct me if I am wrong on this point, no doubt due to padding that may or may not occur depending on what flags were given to the compiler.
To be honest, any time you need to put in a cast in C (not C++) because the compiler is complaining, it's probably a bug. There are very few uses of casting in C (not C++) that aren't bugs. All uses of casting that I've seen in production code were alignment bugs. The few cases you need casting in C is when you are writing generic container functions and want to provide const guarantees to the callers.
Also, 'byte' is not a type in C. You probably mean to use 'uint8_t' or 'uint_least8_t'. I've seen programs use 'char' for bytes, but that isn't correct either as the standard doesn't require 'char' to be unsigned or to be signed (it's left up to the implementation) and 'working' code will suddenly stop working if the program is recompiled on a compiler which defaults to signed char (left bitshift operations on signed integer types are undefined. It's only defined for unsigned integer types).
I've been seeing more and more of this meme "C has weak typing" in various forums recently. In reality there is literally only one or two specific instances where the typing breaks down in C.
|
|
|
|
|
It's power and speed meant no extra weight from seat belts allowed. Just like any language, you learned where and how to be careful. "it corners on like it is on rails! (Pretty Woman)
|
|
|
|
|
I miss the days when all code was C. To quote the master:
“Moira nodded vigorously. She didn't know what BASIC or COBOL were, except that Wiz said they caused brain damage in those who used them.”
― Rick Cook, The Wizardry Compiled
|
|
|
|
|
Love you for bringing this up.
Spent my best years doing C, starting on Atari ST.
Now I'm lazy and use C++ (up to a point).
Much more productive, owing mostly to other people's work (ashamed).
Long live piraCy!
|
|
|
|
|
Technically I'm using C++ but I forget because it's on a microcontroller and no STL so I find myself doing more c-isms than anything.
Real programmers use butterflies
|
|
|
|
|
|
A) It's a juicer, not a bank vault. Whoever decided they needed 12 steps to set it up should be forced to use it
B) It seems easier just to use a regular juicer. Why is your phone even involved?
What even is this?
Real programmers use butterflies
|
|
|
|
|
Because Clooooooooud.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Actually, you need to see my juicer for comparison: 950W motor, spinning wheel-of-death-teeth with filter mesh, I get nervous just washing the damn thing up.
But ... I can drop a whole lemons in it and get the wet and dry components!
Is it connected to the cloud? Not on your nellie ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
That's probably for the best - if it became sentient it would probably be dangerous.
Real programmers use butterflies
|
|
|
|
|
Stephen King could do a follow-up to Christine about your juicer being cloud-connected
Probably have more deaths than that great story...
|
|
|
|
|
Same reason as HP use with their printers - to ensure that you can't use any consumables with it apart from the stupid expensive ones they sell...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
He hehe he!
It's not even a juicer. It's a sorting device used for separating money and idiots.
From: Squeezed out: widely mocked startup Juicero is shutting down | Technology | The Guardian
"Juicero, a Silicon Valley juicer startup that raised $120m from investors and was widely ridiculed after the $400 machines were revealed to be the equivalent of two hands squeezing a juice box, is shutting down."
"Juicero offered pre-sold packets of diced fruits and vegetables that users plugged into the $400 machines, which then transformed the contents into juice. The company was roundly mocked in April when Bloomberg News reported that users could easily squeeze the packets with their hands and turn the contents into juice at a faster rate than the expensive cold-press juicer machine."
|
|
|
|
|
I mean that's fair.
Real programmers use butterflies
|
|
|
|