Closed Bug 537870 Opened 15 years ago Closed 14 years ago

VC7.1 confused by initialized declaration in for-statement conditional

Categories

(Core :: Widget, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9.3a1
Tracking Status
status1.9.2 --- .4-fixed

People

(Reporter: karlt, Assigned: karlt)

References

Details

(Whiteboard: [fixed-lorentz])

Attachments

(1 file)

Bug 518506 comment 43 pointed out that an initialized declaration in the
conditional of a for statement, added in that bug, confused VC7.1.
http://hg.mozilla.org/mozilla-central/annotate/5a63989cada8/widget/src/xpwidgets/nsBaseWidget.cpp#l1005

AFAIK this is valid ISO C++, since at least 1998, but
https://developer.mozilla.org/En/Developer_Guide/Build_Instructions/Windows_Prerequisites
says that mozilla-central and mozilla-1.9.2 (should) build with VC7.1.

(We don't support jemalloc with VC7.1, but that and VC8 may be the reason why
jemalloc is off by default with msvc.
http://hg.mozilla.org/mozilla-central/annotate/5a63989cada8//configure.in#l6713
)

Neil, do you know whether this is the only problem when compiling with VC7.1?
I'm assuming this caused a compiler error.
Do you know whether there is a good way to un-confuse VC7.1?
I guess the only option is to move the declaration outside the loop?
(Out of interest, I guess the same problem would happen with
if, while, and switch statements?)
Summary: VC7.1 confused by initialized declaration in for statement conditional → VC7.1 confused by initialized declaration in for-statement conditional
(In reply to comment #0)
> Neil, do you know whether this is the only problem when compiling with VC7.1?
Actually some of tracemonkey doesn't compile with VC7.1, although there is a pending review (for some time now, so probably bitrotted...) I can't remember any other problems offhand.

> Do you know whether there is a good way to un-confuse VC7.1?
> I guess the only option is to move the declaration outside the loop?
That's what I did to get it to compile locally.

> (Out of interest, I guess the same problem would happen with
> if, while, and switch statements?)
Probably.
Attached patch xpwidget patchSplinter Review
This is easy to fix, so let's fix.  Other options are declaring otherRect
(uninitialized) outside the for-loop, or declaring nextLink (initialized)
outside a while-loop.  But I like narrow variable scopes, so this dereferences
twice (when not optimized) to declare otherRect inside the for-loop.
Assignee: nobody → karlt
Status: NEW → ASSIGNED
Attachment #420442 - Flags: review?(roc)
http://hg.mozilla.org/mozilla-central/rev/29d0fadf3a20
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.3a1
Blanket approval for Lorentz merge to mozilla-1.9.2
a=beltzner for 1.9.2.4 - please make sure to mark status1.9.2:.4-fixed
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: