Thanks in advance.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Int vs. Bool
Collapse
X
-
Int vs. Bool
I'm new to C# programming. I am in possession of some third party software and am thinking of modifying it a bit. The original coder has various flags in the code - simple on/off flags - but he/she has them typed as "int". Is there any valid reason in a C# environment to NOT have these be boolean? Does C# process "int" faster than "bool" or something? The only use of these vars in the code is as "true/false" flags.
Thanks in advance.Tags: None
-
Hi Weston, typically true/false flags are boolean. I can't imagine there is a huge speed difference between the two, other than the ints taking a little bit more memory space than a bool.
I'd recommend contacting the author to see if there is a specific reason s/he used ints, and if there isn't, just go ahead and switch them to bool and see if the is a difference.AustinNinjaTrader Customer Service
-
It might be simply for optimization purposesOriginally posted by Weston View PostI'm new to C# programming. I am in possession of some third party software and am thinking of modifying it a bit. The original coder has various flags in the code - simple on/off flags - but he/she has them typed as "int". Is there any valid reason in a C# environment to NOT have these be boolean? Does C# process "int" faster than "bool" or something? The only use of these vars in the code is as "true/false" flags.
Thanks in advance.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by argusthome, Yesterday, 10:06 AM
|
0 responses
20 views
0 likes
|
Last Post
by argusthome
Yesterday, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
18 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
14 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
9 views
0 likes
|
Last Post
|
||
|
Started by Mindset, 02-28-2026, 06:16 AM
|
0 responses
40 views
0 likes
|
Last Post
by Mindset
02-28-2026, 06:16 AM
|

Comment