From: Kenneth J.Davis (jeremyd@computer.org)
Date: Thu Aug 08 2002 - 17:22:37 EDT
No, this hack is ugly! either work around the problem (trivial)
or Require a compiler that handle's it correctly (they do
exist on Windows, but have other disadvantages -- MSVC 7,
Borland BCC32, GCC based compilers, or perhaps even other
free compilers such as OpenWatcom ...).
Please also see AbiSourceCodeGuidelines.abw, which says:
19. On a subsequent note, don’t do multiple declarations of loop
variables inside the loop in XP code because the win32 compiler
(CL) is stupid and non-conformant:
for (UT_uint32 i = 0; i < 10; i++)
{
// do something 1
}
for (UT_uint32 i = 0; i < 100; i++)
{
// do something loop #2
}
which if I am not misreading, is saying do not declare an
identical named loop variable in multiple for loops that
are in the same scope because there are compilers such as
MS VC 5/6 that use the old style for scoping rules instead of
current ANSI C++ standard for scoping rules. That is, do this:
UT_uint32 i;
for (i = 0; i < 10; i++)
{
// do something 1
}
for (i = 0; i < 100; i++)
{
// do something loop #2
}
But do whatever you want ...
Does anyone else ever look at the [stable] tinderbox pages?
Jeremy
"Mike Nordell" <tamlin@algonet.se> wrote on 8/8/2002 4:39:31 PM:
>
>Kenneth J.Davis wrote:
>
>
>> This backport appears to have broken the Win32 stable build,
>
>Fix it by adding:
>
>#ifdef _MSC_VER
>#define fo if(0);else for
>#endif
>
>It's the standard way to fix this Microsoft bug, and has been for the last
>half decade... :-<
>
>/Mike - anyone wants to pith in on a non-nuclear ICBM? :->
This archive was generated by hypermail 2.1.4 : Thu Aug 08 2002 - 18:13:51 EDT