Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > de.comp.lang.misc > #1922
| Path | csiph.com!weretis.net!feeder4.news.weretis.net!border2.nntp.ams1.giganews.com!nntp.giganews.com!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.am4!peer.am4.highwinds-media.com!peer04.fr7!futter-mich.highwinds-media.com!news.highwinds-media.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Stefan Reuther <stefan.news@arcor.de> |
| Newsgroups | de.comp.lang.misc |
| Subject | Re: Linenoise Competition |
| Date | Sat, 15 Apr 2017 09:43:21 +0200 |
| Lines | 69 |
| Message-ID | <ocspvq.2b4.1@stefan.msgid.phost.de> (permalink) |
| References | <slrnodn6mo.e2i.hjp-usenet3@hrunkner.hjp.at> <slrnoekjl9.1gh.hjp-usenet3@hrunkner.hjp.at> <oce78c.14o.1@stefan.msgid.phost.de> <slrnof197u.243.hjp-usenet3@hrunkner.hjp.at> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=windows-1252 |
| Content-Transfer-Encoding | 8bit |
| X-Trace | individual.net MvujEwbAVjxIACxUdhbOGgkl/pd30saV0sBlxSp8EJiNtmGDWI |
| Cancel-Lock | sha1:vwKvBxaTxtl/knxFNSw2GIht/Wc= |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.5.0 Hamster/2.1.0.1538 |
| In-Reply-To | <slrnof197u.243.hjp-usenet3@hrunkner.hjp.at> |
| X-Received-Body-CRC | 13380219 |
| X-Received-Bytes | 3422 |
| Xref | csiph.com de.comp.lang.misc:1922 |
Show key headers only | View raw
Am 14.04.2017 um 12:31 schrieb Peter J. Holzer:
> On 2017-04-09 18:57, Stefan Reuther <stefan.news@arcor.de> wrote:
>> Das eine Nulloperation in C++11:
>> [=](){}();
>>
>> Der einzige "Operator" darin ist "()" (der Rest ist "sonstige Syntax"),
>> also kann man das schachteln:
>> [=](){[&](){}();}();
>>
>> Noch eine sinnlose Operation davor:
>> a[i++]--,[=](){[&](){}();}();
>> 12345678901234567890123
>> 11111111112222
>
> Da habe ich jetzt erst mal eine ruhige Stunde gebraucht, um das
> auseinanderzuklauben.
Derjenige, der in meinem Softwareentwicklungsteam C++11 vorstellte,
bezeichnete Lambdas als Smiley-Krieg :-)
>> Krieg ich jetzt 'n Keks? :-)
>
> Ja, und noch zwei Extrakekse für die kreative Auslegung der Regeln:
>
> * Die Unterscheidung zwischen "Operatoren" und "sonstiger Syntax"
> * Die Idee, einen Operator ganz am Ende noch einmal zu verwenden, aber
> davor aufzuhören, zu zählen.
Das hast du ja ähnlich gemacht, du hattest ja zwei Dereferenzierungs-
operatoren (*).
Ansonsten ist das Limit für C++ relativ einfach zu ermitteln, wenn man
nur wirkliche Operatoren benutzt (also das, was als "expression"
definiert ist): man nehme alle Postfixoperatoren und klatsche die
aneinander, außerdem alle Präfix-Operatoren, und noch einen möglichst
langen Infix-Operator dazwischen. Das braucht dann nur noch eine
passende Klassendefinition; Operator-Overloading kann quasi alle
Operatorkombinationen legalisieren. Damit komme ich auf...
struct a {
a operator++(int) { return *this; }
a operator--(int) { return *this; }
a operator++() { return *this; }
a operator--() { return *this; }
a operator[](a) { return *this; }
a operator()(a) { return *this; }
a operator<<=(a) { return *this; }
a operator-() { return *this; }
a operator+() { return *this; }
a operator*() { return *this; }
a operator&() { return *this; }
a operator!() { return *this; }
a operator~() { return *this; }
};
typedef a x;
a b,c,d,y;
void foo() {
b(c[d++--])<<=--++-+*&!~(::x)y
// 1234567890123456789012
// 1111111111122
}
...immerhin 22, macht genau garnix ('gcc -O' macht ein 'ret' daraus) und
das sind wirklich nur Operatoren ("::" würde ich persönlich ja als
Streitfall ansehen, steht aber in den meisten Listen von Operatoren drin).
Stefan
Back to de.comp.lang.misc | Previous | Next — Previous in thread | Find similar
Linenoise Competition "Peter J. Holzer" <hjp-usenet3@hjp.at> - 2017-03-29 13:30 +0200
Re: Linenoise Competition "Peter J. Holzer" <hjp-usenet3@hjp.at> - 2017-04-09 17:09 +0200
Re: Linenoise Competition Stefan Reuther <stefan.news@arcor.de> - 2017-04-09 20:57 +0200
Re: Linenoise Competition "Peter J. Holzer" <hjp-usenet3@hjp.at> - 2017-04-14 12:31 +0200
Re: Linenoise Competition Stefan Reuther <stefan.news@arcor.de> - 2017-04-15 09:43 +0200
csiph-web