Login Page - Create Account

Support Board


Date/Time: Wed, 24 Apr 2024 11:49:42 +0000



using word 'short' not allowed as variable?

View Count: 665

[2020-09-23 18:20:25]
User681150 - Posts: 62
i get an error when i use the word 'short' as a variable. i change it to 'shortt' and everything works. see error message below.

is this not allowed to use word short?

: error: expected unqualified-id before '=' token
176 | float short = (sgmidline[sc.Index] < sgmidline[sc.Index-1])

float short = (sgmidline[sc.Index] < sgmidline[sc.Index-1]) && sgmidline[sc.Index] > -60 ;

[2020-09-23 19:47:17]
Sierra Chart Engineering - Posts: 104368
Try using int16_t
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2020-09-23 20:15:59]
John - SC Support - Posts: 31059
"short" is a specific type of integer and therefore is one of the keywords that you cannot use as a variable. Refer to the information here:
https://en.cppreference.com/w/cpp/keyword
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2020-09-24 11:34:14]
bradh - Posts: 854
"short" is a specific type of integer and therefore is one of the keywords that you cannot use as a variable. Refer to the information here:
https://en.cppreference.com/w/cpp/keyword

So is "long". Since it is case sensitive, why not capitalize it as "Short"?
[2020-09-24 22:20:51]
Sierra Chart Engineering - Posts: 104368
Actually we just noticed that you are using "float short". That is definitely invalid. You would want to just use "short" only.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2020-10-01 12:05:09]
User681150 - Posts: 62
i tried using both int16_t and just the word "short". but i get errors

int16_t short ;

test.cpp:233:9:
error: declaration does not declare anything [-fpermissive]
233 | int16_t short ;
| ^~~~~


short ;

test.cpp:233:1:
error: declaration does not declare anything [-fpermissive]
233 | short ;

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account