Hi,

this is a very common naming convention. I have seen it very often in 
C++, not just in ns code. Typically, the "_" (underscore) is used for 
member variables of a class while variable names without "_" are used 
for global and local variable names. This helps to quickly identify 
whether a variable is a class member without having to scroll through 
the code all the time.

Therefore, I personally use "ns" (without underscore) in my scripts 
because it is not a class member but rather refers to an object and is a 
global variable in the script.


bye,
     Martina

Shafiq Hashmi schrieb:
> Hi,
> 
> I understand that the two are the same. But I would like to know why is
> there the tendency to put an 'underscore' at the end of the variables, like
> nodeID_ , msg_ , packetSize_, etc . I understand that in naming a variable
> there is no extra meaning. But is there any naming convention or any benefit
> of it for differentiating with something else. ns2 is filled with all these
> type of variable names.
> 
> Thanx
> SH
> 
> 
> ----- Original Message ----- 
> From: "Sita S. Krishnakumar" <[EMAIL PROTECTED]>
> To: "Realos Osis" <[EMAIL PROTECTED]>
> Cc: "NS users" <ns-users@ISI.EDU>
> Sent: Thursday, February 09, 2006 11:28 AM
> Subject: Re: [ns] difference between ns and ns_ ?
> 
> 
> 
>>it is a variable and you can name it as you please. just make sure you
>>refer to it in the tcl code with whatever name you chose!
>>-Sita
>>
>>
>>
>>>hello,
>>>
>>> I am new to network simulator and also have no experience with tcl.
>>>Right now, I am going through the tutorial from Marc Greis. In some
>>>sample scripts "set ns_ [new Simulator]" is used for creating a
>>>Sumulator object while other scripts go with a simple "ns" without a
>>>succeeding "_" (underscore). I am totally unaware whether it is a tcl or
>>>ns problem.
>>>
>>>Any idea/ hint is much appreciated.
>>>
>>>Cheers.
>>>
>>>
>>
>>
>>
> 

Reply via email to