From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 102b75,45b50f14dadfce5b X-Google-Attributes: gid102b75,public X-Google-Thread: 110292,45b50f14dadfce5b X-Google-Attributes: gid110292,public X-Google-Thread: 1164f8,45b50f14dadfce5b X-Google-Attributes: gid1164f8,public From: brianh@bit3.com Subject: Re: Final kick at the "Merced Guessing Game" Date: 1997/10/08 Message-ID: #1/1 X-Deja-AN: 278826427 References: <61g30t$o2n@news-rocq.inria.fr> Organization: Bit 3 Computer Corp Newsgroups: comp.sys.intel,comp.arch,comp.sys.dec In article <61g30t$o2n@news-rocq.inria.fr>, Robert Harley wrote: > >I think your problem is that C is too flexible for you. It doesn't >wrongly assume that there is one way of laying out and accessing >arrays that is appropriate for all purposes. For instance you can >choose a flat array, 'float *a', or a hierarchy like 'float ***a'. Speaking as someone who is writting a math library in C (in his free time, but I'm actively grappling with these exact issues), also as someone who hardly knows Fortran, this _SUCKS_. You are forced to either: 1) Only accept predefined sized matricies- generally not an option 2) Every time you access the array either type in the whole address equation or use a macro (hideous and it tends to make the code hard to read). 3) In addition to allocating and managing the matrix, also allocate and manage arrays of pointers into the matrix (with resulting overhead and additional complexity). This also kills any locality of reference you're attempting to maintain. This thread started with the hw engineers complaining that C does too much pointer chasing already. 4) Depend upon non-portable compiler-specific constructs. The problem I have found with C's "flexibility" is that most of the time it amounts to "Hey, not only can you reinvent the wheel, you have too! But if, for some braindamaged reason, you want to reinvent the wheel as a _square_ instead of the generally accepted circle, it lets you do that as well!" There are situations where you need to play pointer games (my day job is writing device drivers). But it's hard to call being forced to play pointer games an "advantage". I don't speak for Bit 3. Brian -- "NT and security should never be used in the same breath." - Winn Schwartau, EETimes #972, 22 September 1997 pp.96 -Brian