Csound Csound-dev Csound-tekno Search About

[Csnd] errors in macro with underscore

Date2018-10-25 07:48
FromAndreas Bergsland
Subject[Csnd] errors in macro with underscore

Hi

I had problems when revisiting a csd that used to run on 5.10. It turned out the errors were due to underscores in some of the macros, so that this code

 

#define TEST(V)

#

prints    "$V_"

#

 

instr       1

$TEST(1)

endin

 

would print

$error

 

 

When the underscore was replaced by other signs, it behaved as expected, e.g.

#define TEST(V)

#

prints    "$V-"

#

 

instr       1

$TEST(1)

endin

 

would print

1-

 

as expected

 

Best,

Andreas

 

-- 

Andreas Bergsland

 

Associate professor - førsteamanuensis

Study Programme Leader - studieprogramleder

Music Technology Programme - Musikkteknologiseksjonen

Department of Music - Institutt for musikk

Olavskvartalet

NTNU (Norwegian University of Science and Technology)

7491 Trondheim, NORWAY

 

Visiting address/besøksadresse: Fjordgt.1 (3.etg.)

e-mail: andreas.bergsland@ntnu.no

Office phone (Skype for business):7359 0096

Mobil: 4566 3316

http://folk.ntnu.no/andbe

https://www.vibra.no/

https://www.ntnu.edu/artec


Date2018-10-25 11:50
FromJohn ff
SubjectRe: [Csnd] errors in macro with underscore
We have seen this before.  If _ is a valid characteristics a name then $V_ is an undefined macro.  You need to use $V._ to get concatenation.



⁣Sent from TypeApp ​

On Oct 25, 2018, 07:49, at 07:49, Andreas Bergsland  wrote:
>Hi
>I had problems when revisiting a csd that used to run on 5.10. It
>turned out the errors were due to underscores in some of the macros, so
>that this code
>
>#define TEST(V)
>#
>prints    "$V_"
>#
>
>instr       1
>$TEST(1)
>endin
>
>would print
>$error
>
>
>When the underscore was replaced by other signs, it behaved as
>expected, e.g.
>#define TEST(V)
>#
>prints    "$V-"
>#
>
>instr       1
>$TEST(1)
>endin
>
>would print
>1-
>
>as expected
>
>Best,
>Andreas
>
>--
>Andreas Bergsland
>
>Associate professor - førsteamanuensis
>Study Programme Leader - studieprogramleder
>Music Technology Programme - Musikkteknologiseksjonen
>Department of Music - Institutt for musikk
>Olavskvartalet
>NTNU (Norwegian University of Science and Technology)
>7491 Trondheim, NORWAY
>
>Visiting address/besøksadresse: Fjordgt.1 (3.etg.)
>e-mail: andreas.bergsland@ntnu.no
>Office phone (Skype for business):7359 0096
>Mobil: 4566 3316
>http://folk.ntnu.no/andbe
>https://www.vibra.no/
>https://www.ntnu.edu/artec
>
>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