6d03a317   
   From: francis.glassborow@btinternet.com   
      
   On 04/02/2012 19:31, Edward Rosten wrote:   
   > On Feb 4, 12:43 am, Roman W wrote:   
   >   
   >>> You are also mistaken. C++ certainly does have arrays (statically   
   >>> sized ones)   
   >>   
   >> See, Fortran arrays can be a) dynamically sized and b) multi-dimensional.   
   >> That's a massive difference for the programmer.   
   >   
   > Point a and b are unrelated. C++ optimizers can do inference just fine   
   > on statically sized arrays, even when they've been wrapped up in a   
   > class to behave as multidimensional arrays.   
   >   
   > Point (b) is the only one with any bearing on the article which was   
   > about optimization, not programmer convenience. Currently standard C++   
   > doesn't allow especially efficient and convenient use of   
   > multidimensional dynamic arrays, though common compiler extensions do   
   > allow such things at the expense of safety.   
   >   
   >   
   >>> Well, my solution was to inform the user that aliasing is not allowed   
   >>> in the documentation, and then call dgemm (that was before C99 support   
   >>> was widespread).   
   >>   
   >> That's just pushing the problem downstream.   
   >   
   > Well, yes. That was in the past, when C99 didn't exist in any   
   > meaningful manner (the article was about C and C++). These days, C   
   > solves the problem just fine within the standard. C++ solves it with   
   > some common, nonstandard extensions.   
   >   
   >> It's like saying that you can do OOP in C, and all C++ gives you is some   
   >> syntactic sugar and compile time checking. Technically true, but misses   
   >> the point completely.   
   >   
   > The point of the article was that was that certain optimizations are   
   > impossible in C and C++. C specifically introduced a feature to make   
   > such optimizations possible over 10 years ago.   
      
   Well perhaps. What C did was to provide a method by which a programmer   
   can take responsibility for the consequences of aliasing pointers. In   
   general the compiler cannot check that it has not been handed aliased   
   pointers (that would require whole program analysis -- I guess some   
   implementations might manage that but I suspect that even then something   
   my sneak through, and the rarer the problem the harder it is to detect.)   
      
      
      
   --   
    [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
    [ comp.lang.c++.moderated. First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|