Le 16.10.2013 17:56, Jerry Stuckle a écrit :
You're the one who said programmers need to know a lot of details about the hardware being used, not me. The more you need to knowabout different hardware, the harder it is to write code to fit all ofthat hardware.
I did not said "a lot" but basics. I do not think that knowing that to build a memory cell you can use 2 NAND. I think that it is useful to build PC's applications to know that there is a memory stack. Basics. Knowing that registers have limited size, is also useful: if you program in C, int's size is, IIRC, dependent on those sizes. Indeed, there are now types with fixed sizes, too, but I would not bet that many languages have those.
Of course, you can simply rely on portable libs. But then, when you have a bug which does not comes from what you did, how can you determine thatit comes from a lib you used?I remember having a portability problem, once. A code worked perfectly on a compiler, and not at all on another one. It was not a problem of hardware, but of software: both had to do a choice on a standard's lack of specification (which is something I did not known at that point. Ihave never read the standard sadly.). I had to take a look at asmgenerated code for both compilers to understand the error, and find aworkaround.A good programmer knows what is defined and not defined in the language. For instance, in our C and C++ classes, we teach that the results of something like func(i++, ++i); is not defined.
And I am not a good programmer, I know that perfectly. I have still a lot to learn. The day when I'll claim it anew (I said it, when I was learning bases...) I will simply be really stupid.
What allowed me to understand the problem, was that I had that asm knowledge, which was not a requirement to do what I did.Of course, I have far less experience and grades than it seem you both have, and if I gave a minimalistic sample of the problem you could think that it was stupid, but it does not change that I only was able to fix the problem because of my knowledge of stuff that I have no real need toknow.You should always be aware of the limitations of the language you are using, also.
But those limitations are dependent on the platform they use, for me. See my example with int. In all lessons I had, teachers mentioned short and long, but encouraged to use int instead. And it can give interesting bugs if you use int without knowing that it may have a different meaning depending on the compiler and the CPU.