3 ms·
I skimmed the article and haven't gotten out the compiler or source files, but does anyone understand how arg1 and arg2 with space and no operator in between ar
by zzrrt 6mo ago
I skimmed the article and haven't gotten out the compiler or source files, but does anyone understand how arg1 and arg2 with space and no operator in between are syntactically valid C++, and what do they do?
- zzrrt 6mo agoAha, the syntax is actually `button <- setSize << 10 << 20;` according to DEMO.CPP in /1996/9608/dynacpp.zip of the ISO. So operator-() initializes the Message object, operator<<() stores the parameters into it, which is then passed to operator<() to invoke the function. I guess the HTML page was badly transcribed or failed to escape the characters.
- cobbzilla 6mo agoYes! The linked article didn’t capture all the symbols in the original DDJ article. There were in fact `<<` preceding each arg. The actual line was: obj<-method << arg1 << arg2 which requires overloading the less-than, unary negation, and the double-less-than operators.