[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] Links til god guide



Kim Schulz <sslug@sslug> wrote:
:> 
:> Man behøver ikke nødvendigvis lære OOP for at bruge Java. 
:> Man kan godt lave næsten ren imperativ programmering i Java, og 
:> lære om løkker, if-then-else etc. 


: men hvad skulle formålet med at benytte java så være ? 

At følgende _ikke_ er lovlig kode i Java, som det er i C:

 register n = (count + 7) / 8;      /* count > 0 assumed */

   switch (count % 8)
   {
   case 0:        do {  *to = *from++;
   case 7:              *to = *from++;
   case 6:              *to = *from++;
   case 5:              *to = *from++;
   case 4:              *to = *from++;
   case 3:              *to = *from++;
   case 2:              *to = *from++;
   case 1:              *to = *from++;
                      } while (--n > 0);
   }


Det er Duff's device. De fleste har nok set det, men for de få
der ikke har nydt det... :)

http://www.lysator.liu.se/c/duffs-device.html

"Many people (even bwk?) have said that the worst feature of 
C is that switches don't break automatically before each case label.  
This code forms some sort of argument in that debate, but I'm not 
sure whether it's for or against."

Men ikke i Java:

http://java.sun.com/docs/books/jls/first_edition/html/14.doc.html#35518

Ok, det var et langt sidespring...

Mvh Morten
-- 



 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:09 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *