const letter[]="A" is an array

Try:
if letter<55 then
  var byte another=letter[0]
end if

________________________________
From: 'Oliver Seitz' via jallib <[email protected]>
Sent: January 15, 2021 3:04 PM
To: [email protected] <[email protected]>
Subject: Re: [jallib] Re: Define constant as a char

Hi Rob,

it is no construction with [].

While I can define

const letter[]="A"

and I can send it to a pseudo-variable

serial_hw_data=letter

I can't compare or assign it to a variable:

if letter<55 then
  var byte another=letter
end if

gives "invalid operation"
So, the [] is no real workaround. The workaround now is to have a printed ascii 
table to look up by hand.

 Greets,
Kiste

Am Freitag, 15. Januar 2021, 19:02:44 MEZ hat Rob CJ <[email protected]> 
Folgendes geschrieben:







Hi Kiste,




I think Kyle must have had a reason for it to use the construction with [] also 
for single characters so I am not sure if we should fix this.




Kind regards,


Rob





________________________________
Van: 'Mike' via jallib <[email protected]>
Verzonden: vrijdag 15 januari 2021 15:34
Aan: jallib <[email protected]>
Onderwerp: Re: [jallib] Re: Define constant as a char



Hi Kiste,



It looks like a bug that was introduced at some point.  I found an old JAL 
program, that I know compiled and worked fine, that has this line:




const TAG_UTC      = "a"




Perhaps it happened when going to JALv2, as my program has the old style of JAL 
code, like "include 16f88_4".




Regards,

Mike






On Thursday, January 14, 2021 at 2:55:13 PM UTC-5 Kiste wrote:


>  Hi Mike,
>
> thanks for your reply. It is a constant, there can be a type, but there's no 
> need. If no type is given, it becomes a "universal" type, which adjusts its 
> size to the size of the variables it is used with.
>
> But, still, if I try
>
> const byte FORMAT_DECIMAL = "."
>
> I get the same error.
>
> For the time being, the workaround
>
> const byte FORMAT_DECIMAL[] = "."
>
> (with or without "byte") does the trick, the constant can be used without 
> index, but the definition looks rather strange.
>
>
> Greets,
>
> Kiste
>
> Am Donnerstag, 14. Januar 2021, 00:10:57 MEZ hat 'Mike' via jallib 
> <[email protected]> Folgendes geschrieben:
>
>
>
>
>
> Hi Kiste,
>
> Don't you need a variable type?
>
> const byte FORMAT_DECIMAL = "."
>
> Regards,
> Mike
>
>
> On Wednesday, January 13, 2021 at 3:21:07 AM UTC-5 Kiste wrote:
>> Hi!
>>
>> I can assign a char as an ascii-value to a variable.
>>
>> I can't assign it to a constant:
>>
>> const FORMAT_DECIMAL = "."
>>
>> Compiler says error: type mismatch
>>
>> I can assign it as a constant array:
>>
>> const FORMAT_DECIMAL[] = "."
>>
>> Would it be possible to allow the direct assignment to a single constant?
>>
>> Greets,
>> Kiste
>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "jallib" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit  
> https://groups.google.com/d/msgid/jallib/4149dfec-1cd9-41cf-ab5c-783539636f85n%40googlegroups.com.
>
>



--
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit  
https://groups.google.com/d/msgid/jallib/0e2b44cf-fa3b-4f3b-a893-8bbb0d890cbbn%40googlegroups.com.



--
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/AM0PR07MB6241724C1357EF3F69966B6BE6A70%40AM0PR07MB6241.eurprd07.prod.outlook.com.

--
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/1898663321.400916.1610741055509%40mail.yahoo.com.

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/YQXPR01MB414951F289FC979E3E77A325DEA70%40YQXPR01MB4149.CANPRD01.PROD.OUTLOOK.COM.

Reply via email to