Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

visual c++ 7.1 bug?

0 views
Skip to first unread message

szabolcs.ber...@szuro.hix.hu

unread,
Feb 8, 2006, 9:55:11 PM2/8/06
to

Hello!

a kovetkezo kod nem mux:
int count, i;
for (count = 0, i = 0; i < buf.use; i++)
if (buf.content[i] == 0xa)
count++;

ez viszont igen:
int count, i;
for (count = 0, i = 0; i < buf.use; i++) {
if (buf.content[i] == 0xa)
count++;
}

Az egyetlen kulonbseg a kapcsos zarojel, tehat a ket kod elmeletileg
egyenerteku (gcc is jo eredmenyt ad). Ja, a hibas mukodes: belep a
ciklusmagba egyszer, utana pedig tovabbmegy. Nem noveli 'i'-t sem.
Allat, mi?

Velemeny?

Szabi


volarics...@szuro.hix.hu

unread,
Feb 9, 2006, 9:55:10 PM2/9/06
to
Nem látom a külömbséget!!! (lehet, hogy vak vagyok?)
Tahán így korrektebb:
int count=0;
for (int i = 0; i < buf.use; i++) {

if (buf.content[i] == 0xa)
count++;
}
mivel i-nek nem használod az értékét.
De az égész ciklus a buff.use értékén áll.

:Voli

marsgustav_...@szuro.hix.hu

unread,
Feb 10, 2006, 9:55:11 PM2/10/06
to

Hello!

Miert nem visszafele szamoltok?
....
for(i=buf.count-1; i!=0; i--)
....

Az 0-val osszehasonlitas gyorsabb mindenfajta
procin, es a forditonak is konnyebb dolga van vele.
Tehat: kevesebb hiba, es az utasitas-atlapolas is jobb lesz.


denes


starters_u...@szuro.hix.hu

unread,
Feb 11, 2006, 9:55:11 PM2/11/06
to

>> for (count = 0, i = 0; i < buf.use; i++)
> for(i=buf.count-1; i!=0; i--)
Szerintem ez a nyero: for(i = buf.use; i--;)
Szep nyelv a C...

u.i.:Ez a szoveg mitol angol? A sok angol parancstol? A CODER-nal
igazan lehetne egy kicsit valtoztatni az aranyon: nem sok programozasi
nyelv letezik, ami magyarul irhato...

0 new messages