Closed Bug 156902 Opened 23 years ago Closed 23 years ago

Extremely unreadable code

Categories

(Core :: CSS Parsing and Computation, defect, P4)

defect

Tracking

()

RESOLVED FIXED
mozilla1.2alpha

People

(Reporter: moz, Assigned: dbaron)

Details

(Whiteboard: [patch][whitebox])

Attachments

(1 file)

Below is a piece of code from nsRuleNode.h that I stumbled upon and had a hard time to read: Typecasting "this" to char* and adding an offset for accessing members is very evil. At the very least a better documentation would be in order. The best thing is the NOTE: guess what the note says in nsStyleContext::SetStyle! nsStyleStruct* CachedStyleData::GetStyleData(const nsStyleStructID& aSID) { // NOTE: nsStyleContext::SetStyle works roughly the same way. const StyleStructInfo& info = gInfo[aSID]; char* resetOrInheritSlot = NS_REINTERPRET_CAST(char*, this) + info.mCachedStyleDataOffset; char* resetOrInherit = NS_REINTERPRET_CAST(char*, *NS_REINTERPRET_CAST(void**, resetOrInheritSlot)); [...]
Target Milestone: --- → Future
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Priority: -- → P4
Whiteboard: [patch]
Target Milestone: Future → mozilla1.2alpha
Do you need review and approval to check in a comment only patch? I was under the impression that mozilla.org was in desperate need of documentation and there was blanket permission. (I could be wrong.) Also, there is a typo at the end where "for" is spelled "fore". Other than that it looks good to me.
Keywords: review
Comment on attachment 90967 [details] [diff] [review] patch to add comments explaining the code Ah, yes... this code.. ;) s/fore/for/ as Mike said, and sr=bzbarsky.
Attachment #90967 - Flags: superreview+
Fix checked into trunk, 2002-08-06 06:46 PDT.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
this does look like a code level verification
Whiteboard: [patch] → [patch][whitebox]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: