Saturday, May 11, 2024
 Popular · Latest · Hot · Upcoming
119
rated 0 times [  121] [ 2]  / answers: 1 / hits: 32318  / 15 Years ago, thu, april 23, 2009, 12:00:00

In a lot of languages with simple OO capability (PHP 4), or misunderstood OO capabilities (Javascript, C using function pointers, etc.), you'll end up with a function naming convention that uses leading underscores to to indicate privilege level.



//ex.
function _myPrivateFunction(){
}


While individual teams are always going to come up with their own naming conventions like this, the underscore convention seems so prevalent that it made me curious about




  1. Where the technique first came from

  2. If there was ever any standardized systems (sort of like hungarian notation) developed around the convention



Beyond pure curiosity, I'm seeing this in a few codebases I'm dealing with right now, and I'd like to understand the possible headspaces of the developers who originally came up with it.


More From » php

 Answers
10

In C++ world, member names that start with underscore are reserved for use by compiler (or low level STL like API) developers. It's not prohibited by compilers in any way, but that's the tradition.



This wiki link is quite informative on underscore.


[#99657] Friday, April 17, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
cindyanyssam

Total Points: 483
Total Questions: 94
Total Answers: 100

Location: Barbados
Member since Sat, May 28, 2022
2 Years ago
;