About programing, a general question

Parshwa Murdia b330bkn at gmail.com
Tue Dec 21 20:48:34 UTC 2010


On Wed, Dec 22, 2010 at 12:24 AM, Jerry Feldman <gaf at blu.org> wrote:

I learned C from K&R, from the tutorial that was included with Unix, and
> the fact that I was told I had to maintain the Unix CShell. Fortunately
> at the time I knew a number of languages including IBM 360/370,
> AutoCoder, Burroughs, PDP-8, PDP-11, and Raytheon PTS1200/PTS100
> assembly. My real learning experience was looking at the code generated
> by COBOL. You can see how some compilers generate the code, but you can
> also see how some decisions you make at the high level language affect
> the actual code. I was taught that looping through an array by using
> pointers was much faster than subscripting through the same array. BUT,
> when working with the compiler group on Tru65 Unix I found that
> subscripting was actually much faster when using an optimizing compiler
> because the compiler must dereference every pointer, but when
> subscripting, it can keep the array base in a register. I had some old C
> code that I used to first test that pointers are better than
> subscripting, and I then tested that in the Tru64 compiler on the Alpha,
> and subscripted loops were faster.
>
> Basically, the first rule I always use is to write code clearly and
> concisely. Remember that someone (you or someone else) may have to debug
> it. If you need to make the code work faster, then is the time to
> analyze, and we have some really neat tools like graphical profilers
> that can point out bottlenecks, and many times these surprise even the
> most experienced programmers.
>
> Basically, the CPU generally does a few things. While there are major
> differences, between CISC and RISC, you load an address into a register,
> perform some operation on that register, such as add, subtract,
> multiply, divide, or, not, and, and a few more. Then you save the
> contents into memory. Of course there are branch and conditional branch
> where you go to a different part of the code based upon a true or false
> condition. To really understand computer logic, an interesting approach
> is to build a computer using plugboard parts. Remember, everything in a
> computer is binary not decimal, not octal (3 bit representation of
> binary), not hexadecimal (4 bit representation).
>
> --
> Jerry Feldman
>


This is much related with Assembly language.


-- 

Regards,
Parshwa Murdia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.fedoraproject.org/pipermail/users/attachments/20101222/7f51f610/attachment.html 


More information about the users mailing list