Csound Csound-dev Csound-tekno Search About

[Csnd] Array with +=1

Date2019-10-30 09:21
FromTarmo Johannes
Subject[Csnd] Array with +=1
Hi,

Do you get the same result:

giCurrentEvent[0] = giCurrentEvent[0] + 1 ; works

giCurrentEvent[0] += 1 ; fails


in the latter case the error message is:

error: syntax error, unexpected NEWLINE, expecting T_OPCODE or T_FUNCTION or ',' or '=' (token "")



Greetings,

tarmo


Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2019-10-30 20:21
Fromjoachim heintz
SubjectRe: [Csnd] Array with +=1
hi tarmo -

yes, same result as for you, with latest dev build.

my error message is slightly different:
error: syntax error, unexpected S_ADDIN, expecting T_OPCODE or 
T_FUNCTION or ',' or '='  (token "+= ") from file 
/home/jh/Desktop/test3.csd (1)
  line 13:
 >>>giCurrentEvent[0] +=  <<<

my code:
giCurrentEvent[] fillarray 1, 2, 3
giCurrentEvent[0] += 1
print giCurrentEvent[0]

with
giCurrentEvent[0] = giCurrentEvent[0] + 1
it works, as you say.

best -
	joachim


On 30/10/19 10:21, Tarmo Johannes wrote:
> Hi,
>
> Do you get the same result:
>
> giCurrentEvent[0] = giCurrentEvent[0] + 1 ; works
>
> giCurrentEvent[0] += 1 ; fails
>
>
> in the latter case the error message is:
>
> error: syntax error, unexpected NEWLINE, expecting T_OPCODE or
> T_FUNCTION or ',' or '=' (token "")
>
>
>
> Greetings,
>
> tarmo
>
>
> Csound mailing list Csound@listserv.heanet.ie
> 
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
> https://github.com/csound/csound/issues Discussions of bugs and features
> can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2019-10-30 21:24
FromBernard Geyer
SubjectRe: [Csnd] Array with +=1
I discovered this behavior in 6.12.1





--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2019-10-30 21:25
Fromjohn
SubjectRe: [Csnd] Array with +=1
Currently += -= *= /= are only defined for use with an identifier on the 
left.  I wil add it t te ist of niggles


On Wed, 30 Oct 2019, joachim heintz wrote:

> hi tarmo -
>
> yes, same result as for you, with latest dev build.
>
> my error message is slightly different:
> error: syntax error, unexpected S_ADDIN, expecting T_OPCODE or T_FUNCTION or 
> ',' or '='  (token "+= ") from file /home/jh/Desktop/test3.csd (1)
> line 13:
>>>> giCurrentEvent[0] +=  <<<
>
> my code:
> giCurrentEvent[] fillarray 1, 2, 3
> giCurrentEvent[0] += 1
> print giCurrentEvent[0]
>
> with
> giCurrentEvent[0] = giCurrentEvent[0] + 1
> it works, as you say.
>
> best -
> 	joachim
>
>
> On 30/10/19 10:21, Tarmo Johannes wrote:
>> Hi,
>> 
>> Do you get the same result:
>> 
>> giCurrentEvent[0] = giCurrentEvent[0] + 1 ; works
>> 
>> giCurrentEvent[0] += 1 ; fails
>> 
>> 
>> in the latter case the error message is:
>> 
>> error: syntax error, unexpected NEWLINE, expecting T_OPCODE or
>> T_FUNCTION or ',' or '=' (token "")
>> 
>> 
>> 
>> Greetings,
>> 
>> tarmo

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here