On 7/14/2015 1:39 AM, Thomas Zimmermann wrote:
When writing code, I consider it good style to not write into anything that starts with an 'a' prefix, except result arguments.
"You should never write into something with an 'a' prefix except when you should," if you simplify it. I've actually avoided using the a prefix for outparams precisely because it feels more consistent to never assign to a variable with an a value (and also because it distinguishes between Foo *aInArray and Foo *outparam), yet I did see someone upthread praising that it helped you see which values were outparams.
Makes the code cleaner, more readable, and often gives it a clear structure. When reading the code later on, it's easy to spot the parts of a the code that directly depend on external parameters by looking for 'a' and 'm' prefixes.
This, I feel, is an aspiration which is not supported by any of the code I work on (which admittedly is heavily COMtaminated). Any intuition about a difference between aFoo and foo in terms of "relies on arguments" is bound to be wrong.
Given that the aFoo rule is one of the least adhered-to portions of our style guide, and has been for as long as I've worked on Mozilla code; that the ancillary rule of "don't assign to an argument" has also been ignored on quite a few occasions; and that there hasn't been any real history of people complaining about the lack of adherence to this style guide point, I rather suspect that whatever people might say in how useful the 'a' prefix is, they get along quite fine without it.
-- Joshua Cranmer Thunderbird and DXR developer Source code archæologist _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform