From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: *** X-Spam-Status: No, score=3.8 required=5.0 tests=BAYES_00,INVALID_MSGID, RATWARE_MS_HASH,RATWARE_OUTLOOK_NONAME autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fc89c,97188312486d4578 X-Google-Attributes: gidfc89c,public X-Google-Thread: 109fba,baaf5f793d03d420 X-Google-Attributes: gid109fba,public X-Google-Thread: 1014db,6154de2e240de72a X-Google-Attributes: gid1014db,public X-Google-Thread: 103376,97188312486d4578 X-Google-Attributes: gid103376,public X-Google-Thread: 10db24,4cf070091283b555 X-Google-Attributes: gid10db24,public From: "Tim Behrendsen" Subject: Re: What's the best language to learn? [was Re: Should I learn C or Pascal?] Date: 1996/08/21 Message-ID: <01bb8f13$cf09d7e0$32ee6fce@timhome2>#1/1 X-Deja-AN: 175555492 references: <4v26j4$hkg@news.csus.edu> <01bb8d2f$351b9500$32ee6fce@timhome2> <4vdon9$8nt@news1.mnsinc.com> content-type: text/plain; charset=ISO-8859-1 organization: A-SIS mime-version: 1.0 newsgroups: comp.edu,comp.lang.ada,comp.lang.c,comp.lang.c++,comp.unix.programmer Date: 1996-08-21T00:00:00+00:00 List-Id: Szu-Wen Huang wrote in article <4vdon9$8nt@news1.mnsinc.com>... > Tim Behrendsen (tim@airshields.com) wrote: > [snip] > : Hmmm... moving a deck of cards around to learn a sorting > : technique. Reducing the problem to a very low-level set of > : movement operations to help in understanding procedurally > : what the computer is doing. Naaah, couldn't work. Much easier > : to focus on the high-level C abstraction of the sorting > : algorithm. ;-> > > Lofty, ungraspable concepts like: > > void swap(int *a, int *b) > { > int c = *a; > > *b = *a; > *a = c; > } > ... > swap(&a, &b); > ... > > ? swap(), by the way, is a primitive for just about every algorithms > text I've ever read. Does knowing the computer must: > > LOAD r1, a > ADD something_else_totally_unrelated > LOAD r2, b > INC some_counter_from_another_place > STOR r1, b > INC that_same_counter_but_we_just_need_to_fill_the_slot > STOR r2, a > > in order to swap two integers aid in the understanding of swap()? > I agree that we need to break an algorithm down to primitives, but > are you actually saying swap(), for instance, isn't primitive enough? I'm not quite following your assembly translation, but let me roll with it. Yes, I think this is a *great* example of how the assembly would be much simpler than the C. What are they looking at when the look at the C code? Look at all the syntax involved in that thing. a and b exist somwhere, but where? Never mind, they're variables. Argument passing, indirection, automatic variables, on and on. Can you honestly say an assembly translation with the memory map right beside wouldn't be easier to understand? It would be completely obvious, and you wouldn't be bogged down with all that syntax. -- Tim Behrendsen (tim@airshields.com)