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 CarlTrading, 03-31-2026, 09:41 PM
|
1 response
66 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
36 views
0 likes
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
59 views
1 like
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
62 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
53 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment