0

I think back to many tutorials and code snippets in which I have seen variables, functions, and files with "my" or "my_" prepended. What is the origin of this convention?

13
  • 3
    The origin of this convention is English grammar providing possessive pronouns to indicate the desired semantics in a mnemonic way. Perhaps, you mean "what was the earliest known publication using that convention"? If so, please edit your question for clarity.
    – Leo B.
    Nov 4 at 1:49
  • 2
    maybe so it doesn't conflict with built-in objects of the language? I remember defining MyString, MyFile... Nov 4 at 5:26
  • 7
    Editorial ‘we’ is pretty standard, it’s nothing exclusive to code comments. Nov 4 at 5:56
  • 6
    It's not a convention, it's just the author of that tutorial telling you that this is your/their own version of it. It's often used to differentiate a standard library function from your own implementation (strlen vs. my_strlen) Nov 4 at 11:39
  • 4
    The correct names to use for example variables are 'foo', 'bar', and 'mumblefrotz'. Nov 4 at 11:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.