4

I am very good java script developer, but newbie to flash. I have started learning action script. I am reading code snippets at many places. I found that variable names starting with m_Variable_Name or _Variable_name. What does that mean when it starts with m_ or _ ? Can anyone throw a light on coding standard?

Sample code :

 public class Person implements IPerson
 {
  private var m_name:String;

  public function get name():String
  {
   return m_name;
  }

  public function set name(value:String):void
  {
   m_name = value;
  } 
 }
2
  • 1
    _name > anything else > m_name imo. Commented Mar 5, 2012 at 11:47
  • 1
    m_name came from C++, all AS3 developers I know hate when m_ is used in AS3 classes. Ported C/C++ code looks so ugly in AS3. Commented Mar 5, 2012 at 12:38

3 Answers 3

11

Here are Adobe Coding Conventions.

Some people use m_ or _ to prefix member variables to distinguish them from local variables.

Sign up to request clarification or add additional context in comments.

1 Comment

Adobe changed url for above link, now it's located here - sourceforge.net/adobe/flexsdk/wiki/Coding%20Conventions If anyone comes here from Google (as I have), it may help them :)
3

prefixes m_ is used as a prefix for member variables.

Comments

3

Prefixing variable names is not a requirement, it's more of a naming convention that you might choose to use.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.