From: "\"Nils O. Selåsdal\"" <noselasd@asgaard.homelinux.org>
To: 9fans@cse.psu.edu
Subject: [9fans] KenC operator overloading.
Date: Sat, 7 May 2005 18:56:32 +0200 [thread overview]
Message-ID: <427CF340.4060807@asgaard.homelinux.org> (raw)
Hello,
I recently ventured down the cmd/cc/ sources. And what did I discover ?
Take a peek of the following (sorry ass of an -) example and see yourself.
#include <u.h>
#include <libc.h>
struct Foo {
int x,y;
};
typestr struct Foo Foo;
Foo Foo_add_(Foo a,Foo b)
{
return (Foo){a.x+b.x, a.y+b.y};
}
void main(void)
{
Foo f1 = {1,1},f2 = {2,2},f3;
f3 = f1 + f2;
print("%d,%d\n",f3.x,f3.y);
exits(nil);
}
Neat, no ?
Any particular reason this isn't documented ?
--
Nils O. Selåsdal
next reply other threads:[~2005-05-07 16:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-07 16:56 "Nils O. Selåsdal" [this message]
2005-05-07 16:59 ` Rob Pike
2005-05-07 18:26 ` jmk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=427CF340.4060807@asgaard.homelinux.org \
--to=noselasd@asgaard.homelinux.org \
--cc=9fans@cse.psu.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).