rainwarrior wrote:
Kasumi, what's unfair about that example? Messing up your stack is an entire class of errors that are impossible in C because the stack is abstracted away for you.
How about messing up on braces in a way that will compile? I've had an error like that. I'm saying that hard-to-debug-because-you're-reading-what-you-think-is-there-rather-than-what's-there errors aren't unique to assembly. Even with a compiler,
to a new person, the errors can occasionally be pretty unhelpful. An experienced programmer would never miss an RTS, not mess up their braces, or would catch these things immediately. But I honestly don't think it's so different for a new guy to C or assembly. I didn't think it was a fair example, because I imagine the same person would experience similar errors whether it was C, assembly, Java, or visual basic.
How about something like this:
Code: Select all
int function(int x){
int mario[10];
//Do some actions on the mario array. Maybe to count how many times
//the numbers 0-9 are used in some global data.
return mario[x]//Then return the count.
}
I thought it was safe to assume that all the values in mario[10] would be initialized to 0, which isn't true here. So this function would never work as expected, and the compiler I was using at the time didn't tell me anything, because (I'm guessing) at least some of mario was touched each time it was run. (Otherwise, it would warn me I was trying to return an uninitialized variable.) That's a close example to something I encountered when I started out. In fact, I believe it wasn't until my first use of malloc that something actually clicked and I understood WHY it would be stupid to expect all arrays to be initialized to 0 at runtime.
I can name quite a few similar things in C I did not understand
because it was abstracted from me. Learning C was a battle for me, and 6502 assembly absolutely wasn't. I guess I'm the only one.
~J-@D!~ wrote:
Seriously, I don't even understand the "assembly is easier than C" point. From a beginner's perspective, it's a lot of potential pitfalls your assembler will not even give a hint about it.
I didn't say assembly was easier to program in (in fact I said the opposite), or that it was easier. I said in my experience it's easier to teach and learn, and I think it's because (for 6502 at least) it does about a single thing at a time. Even if you never use the language to actually make anything other than examples, it gives you a really great understanding of programming.
I agree C(++) has a better workflow, and if we weren't programming for NES I'd recommend it every time. I'm sharing my personal experience of 6502 being easier, and saying C(++) still has lots of room for beginner mistakes that seem to be ignored whenever these discussions come up. I'm not even sure 6502 assembly has
more pitfalls for a beginner honestly. It's definitely true that a compiler is more helpful than an assembler when such errors occur, though.