Hi,

I have the feeling that the author of

https://github.com/eclipse-openj9/openj9/blob/master/runtime/vm/classsupport.c.

might not know/like/understand the && operator.

The huge case testing length and values can be contracted into a single if.

using     (len = 3 && memcmp(v,"ddd",3)

   Ah the || operator. :-)

not talking about a static inline or macro in order to avoid writing "3" twice. caution about obfuscation)

This "smells" using C like simple assembler.

Or the used compiler optimations cannot be trusted ;-)

When I read if a if b if c  I tend to expect some else. ==> if a && b && c

the  "goto done" can either be return whatever, it is done in almost all other 
situations).

I don't want to go into a length debate about 'return'.

if cond1 { ... return } if cond2 { ... return }

vs using "else" is sometimes "not so bad".

The "techniques" used in the code are not consistently used, and this *may* 
hurt the reader.

Anecdote: In Simula (and Algol?) :

     a & b     is    a AND b

     a && b   is    if a THEN b else TRUE

==>    if (a && b) { .. becomes

      if if a then b else true then begin ...

you might or might not like it.

doing things before return or at the end of a block: syntactically "finally" or the infamous "else" in a python "for".

I kind of cheated in assembler:  Whatever "block"  (block, (if, (loop, (while, (for, ...) there is a "POSTLUDE name" (kind of named finally) and a "SIGNAL name" from the inside in order not to use GOTO. Wording is all.

       (block ...   SIGNAL c1  ...  SIGNAL c2 ...   POSTLUDE c1 ... POSTLUDE  
c2 ...  block)

writing all kind of variations of

       goto end;

case1:  whatever := nonsense; goto end;

case2 : ....

end:  return whatever

shows what:   C can be regarded as a better macro assembler (and this very 
useful for OS kernel dev)

The point is readability, expectation, avoiding noise ...  and obfuscation is a 
funny game.

I got used to hear (but extremely rarely to read) qualifications such as  "c'est la merde"  or "so'n Scheiss mach i nett".

I know two generations considered "lost" (grandpa was in Verdun and "dad" was 
born in 1922)


Best

Peter






----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to