Hi!

12-Июн-2006 07:48 [EMAIL PROTECTED] (Blair Campbell) wrote to
[email protected]:

 >> >> BC> +    return( int )( *( ( char far * )MK_FP( 0x0040, 0x0051 ) ) + 1 );
 >> >>       Second, code above not bug, but wrong, because you return position
 >> >> only on video page 0, whereas active may be another video page. Ie., you
 >> >> should use byte at 0:62 as index in array of positions:
BC> Does FreeCOM ever switch video pages? no.  The point of getting rid of
BC> CONIO was to get rid of unused code...

      Pages may be switched by _any_ program (resident or called from shell
command line), and shell should correctly behave in this case.

 >> >> BC> +void outc(char c)
 >> >> BC> +   fflush( stdout );
 >> >> BC>     write( 1, &c, 1 );
 >> >>       Why not use fwrite() here?
BC> Because the code that's there works just as well.

      But you shoud here add fflush(), and this (slightly) increases code and
noticeably slowdowns output (in case of long output, mixed by calls to
outc()). So, which _gain_ in using write() here?

 >> >> BC> +++ fcompl2.c       12 Jun 2006 04:55:42 -0000      1.4
 >> >> BC> +#undef putchar
 >> >> BC> +#define putchar outc
 >> >>       Why not use outc() explicitly?!
BC> Why?

      Because, if later you change outc() behavior, there may be much less
efforts to find (and check) all calls to outc() - currently you may forget,
that it hidden (in some places!) by putchar()...

      Especially, outc() currently has _different_ behavior - currently, with
your patch, unlike putchar() it always flushes stream, and reader of code
may be unaware, that in given point flush is performed. With explicit calls
to outc() he will know this.

 >> >> BC> +++ cbreak.c        12 Jun 2006 04:55:42 -0000      1.3
 >> >> BC> +void mycprintf( char *fmt, ... )
 >> >> BC> +    vsprintf( buffer, fmt, args );
 >> >> BC> +#define cputs mycprintf
 >> >>       Then you in trouble, if there will be encountered "%" in string.
BC> But % is never encountered because cputs is only ever used to print
BC> \r\n.

      Then why not use mycprintf("\r\n") explicitly? And don't forget about
future, whereas someone other may add "%" output through cputs() (because he
will be sure, that cputs() is an sincere function and performs what is
declared - "output of string without additional processing"), and then he
gets hard-to-catch bug!

BC> You would have known that if you read the code.

      I think also about future extensions and about maintaining code. Lay
troublesome for future maintaining isn't good point.

 >> >> BC> +++ prprompt.c      12 Jun 2006 04:55:42 -0000      1.5
 >> >> BC> +#define putchar outc
 >> >>       Same question: why not use outc() explicitly, especially you anyway
 >> >> change all occurrence of putchar()?!
BC> Because it's easier and a programmer will still understand what it does.

      He will _think_ that he understand, but he gets not what he _expected_!
Because outc() behavior isn't identical (it uses flushing) to declared for
putchar()! Thus, this substitution deceives programmer!

BC> Arkady, PLEASE stop reading my changes and trying to find fault with
BC> them,

      Do you really want to stop foreign audit?

BC> as I am the first to actually make changes to FreeCOM in a
BC> while.  It'd be nice to get some thanks once in while.

      Thank you, Blair! But I just want to see better (and more bugless)
code.

BC> I didn't see anyone thank me for fixing some bugzilla bugs...
BC>  https://lists.sourceforge.net/lists/listinfo/freedos-devel

      Thank you, Blair! Seriously, thank - sorry, we sometime accept as
indebted others work without explicit gratitudes. :( Forgive this our
impolitness. :)


_______________________________________________
Freedos-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to