Open Bug 1128930 Opened 9 years ago Updated 2 years ago

mozilla::Array does not allow aggregate initializers

Categories

(Core :: MFBT, defect)

defect

Tracking

()

REOPENED

People

(Reporter: emk, Unassigned)

Details

Attachments

(1 file)

Attached patch patchSplinter Review
Because mArr is private.
Attachment #8558495 - Flags: review?(jwalden+bmo)
Comment on attachment 8558495 [details] [diff] [review]
patch

Review of attachment 8558495 [details] [diff] [review]:
-----------------------------------------------------------------

::: mfbt/Array.h
@@ +24,1 @@
>    T mArr[Length];

Interesting, I didn't know this was a requirement to use aggregates.  :-(

I guess specs deal with this must-be-public requirement by using a reserved name.  We can't do that ourselves because, well, we're not implementing the language.  So let's at least rename this a bit to make clearer that this is Not To Be Touched.  Could you rename this to |mPrivateArrFieldDoNotUse|?  Or something that makes clear people must not use this directly.
Attachment #8558495 - Flags: review?(jwalden+bmo) → review+
I found our portability guide did not allow to use initializer lists with objects :(
https://developer.mozilla.org/en-US/docs/Mozilla/C++_Portability_Guide#Don%27t_use_initializer_lists_with_objects
It would be better to enforce the restriction until the guide is reconsidered. Luckily, mozilla::BinarySearchIf worked with plain arrays.
No longer blocks: 1128227
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → WONTFIX
I'm pretty sure our style guide is Just Wrong there, because it's unbearably ancient on the point.  Certainly HP-UX we don't care about that much -- it better be using supported gcc and such, and I doubt there's a portability concern for such gcc on HP-UX.
Status: RESOLVED → REOPENED
Resolution: WONTFIX → ---
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: