Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!portal!cup.portal.com!stephan From: stephan@cup.portal.com (Stephen Derek Schaem) Newsgroups: comp.sys.amiga Subject: Re: To macro, or not to macro? (LONG) ... a programming style. Message-ID: <19192@cup.portal.com> Date: 7 Jun 89 06:12:38 GMT References: <2454@van-bc.UUCP> <375@xdos.UUCP> Organization: The Portal System (TM) Lines: 25 Talking about C and macro.Usally macro can be used in alot of context and from that need to do 'extra' work for adjusting itself. Assembly code made from a C source is 'stupid', saving register that don't need to be, using an inapropriate addresing mode etc.. etc.. and for opt anything it should be well thought and usally a routine will only work in the context you wrote it! I had a big discusion (over 10 hours) about C an ASM, and what I found is some people think that well thought C can be equivalent to normal asm... I try to prove my point but they never wrote a line a asm code, So I'm making a could of disassembly of C to show how uglly it's working! I use a very optimize routine for reading-sorting files, I alway use the N=number of file, N+N-1+N-2+N-3 (N time) It's still faster than anything I saw.. Anyway, I just wnated to say That macro are not faster than sub (Well if you count 34cycle:-) for a short number of call... All depand on how big is the rouitne do, how long it take.You should think in a %... In short loop called frequently the code should be directly writen and optimized at the max to fit the environment!. If you still think macro for those cases, oh well.Since macro need most of the need a little overhead processing, moving something to the right register. Just that Could creat a slow down in some casses. And if you have an overhead or any thing related than it's not a macro anymor in a sens!