Bug? sprintf + forward

woyteg's icon

Hey, maybe its my mistake, but i think i found a strange bug. on the left of this patcher there's the combination of a sprintf formated message to forward.
max says "forward - First extra argument must be a symbol" same on the right side but a message box between sprintf and forward, working. ?!
(using max 5.0.7)

Max Patch
Copy patch and select New From Clipboard in Max.

bkshepard's icon

I don't think it's a bug in [sprintf], but a characteristic of the way the comma works in a message box. The string coming from [sprintf] is treated as one item. In the message box, the comma separates the string into two separate messages. [forward] needs to get two messages: one to tell it where to send, and the other to tell it what to send. When it comes directly from [sprintf] it thinks it is only getting one message.

Try this for an example of the way the comma works when coming directly from [sprintf] and when it comes from a message box.

Max Patch
Copy patch and select New From Clipboard in Max.

Peter Castine's icon

Your mistake. No bug.

Sorry to be zen-ishly blunt, but what else can I say?-)

sprintf's job is not to parse strings using commas to delimit and serialize messages. Sprintf's job is to build messages of symbols, ints, floats, and (possibly) backslash-escaped special characters. Which is what it does. Replace your first forward object with a print, and you'll see what sprintf is doing, which is exactly what it's supposed to do.

Here's a simpler way to achieve the same effect. Sprintf is nice, but it's not the only tool in the shed.

Max Patch
Copy patch and select New From Clipboard in Max.

There may well be even simpler ways to achieve the effect.

woyteg's icon

i see your point, thanks. I thought most objects would treat a comma separated input message as two serial messages.
cheers