Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | "BartC" <bc@freeuk.com> |
|---|---|
| Newsgroups | comp.lang.c |
| References | <xAMus.600270$yH4.30685@fx03.am4> <1b7gozsmph.fsf@snowball.wb.pfeifferfamily.net> |
| Subject | Re: Macros |
| Message-ID | <OP0vs.717447$lz1.645754@fx28.am4> (permalink) |
| Organization | virginmedia.com |
| Date | 2012-12-03 12:20 +0000 |
"Joe Pfeiffer" <pfeiffer@cs.nmsu.edu> wrote in message
news:1b7gozsmph.fsf@snowball.wb.pfeifferfamily.net...
> "BartC" <bc@freeuk.com> writes:
>
>> I'm trying out these macros to save on typing and errors** :
>>
>> #define else } el##se {
> No, no, no.
>
> Many new C programmers have made this mistake -- I was one of them.
Possibly that tells you something about the language...
> C has a syntax. It may or may not be a good syntax, but it is C's
> syntax.
Maybe. A 'good' syntax that requires external tools to encode/decipher type
declarations, or to count braces, or (in my case) to create lists of local
and global function prototypes that would otherwise take half my time to
maintain.
> Using macros to try to create a new syntax for C leads to
> madness. Just... don't.
Well, I've given up on that, because it's not up to the job. As I've said,
I'm using an external tool to convert source code in a kind of hybrid
language to what is considered normal C code.
It's a crude tool that converts source a line at a time (so that line
numbers correspond), but it seems to work.
Braces have been almost entirely eliminated. Endings for if, switch, while
etc are distinct (rather than be all "}"). Function prototypes are taken
care of (they are placed in two include files, one for locals, one for
exports).
There were a few other things which weren't that important, but in this
language implementation project, they were changed to match the target
language (for example, using := and =, instead of = and ==).
And, the output is perfectly readable, ordinary C. Where the braces always
match up.
--
Bartc
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Macros "BartC" <bc@freeuk.com> - 2012-12-02 17:53 +0000
Re: Macros Öö Tiib <ootiib@hot.ee> - 2012-12-02 10:11 -0800
Re: Macros James Kuyper <jameskuyper@verizon.net> - 2012-12-02 13:58 -0500
Re: Macros Öö Tiib <ootiib@hot.ee> - 2012-12-02 13:37 -0800
Re: Macros falk@rahul.net (Edward A. Falk) - 2012-12-04 23:59 +0000
Re: Macros James Kuyper <jameskuyper@verizon.net> - 2012-12-04 19:14 -0500
Re: Macros Heikki Kallasjoki <fis+usenet@zem.fi> - 2012-12-05 00:58 +0000
Re: Macros James Kuyper <jameskuyper@verizon.net> - 2012-12-04 20:44 -0500
Re: Macros Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-12-04 20:03 -0500
Re: Macros James Kuyper <jameskuyper@verizon.net> - 2012-12-04 20:48 -0500
Re: Macros Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2012-12-05 23:17 +0200
Re: Macros "BartC" <bc@freeuk.com> - 2012-12-02 19:54 +0000
Re: Macros Ian Collins <ian-news@hotmail.com> - 2012-12-03 09:14 +1300
Re: Macros Greg Martin <greg@softsprocket.com> - 2012-12-02 12:38 -0800
Re: Macros pete <pfiland@mindspring.com> - 2012-12-02 16:28 -0500
Re: Macros Rui Maciel <rui.maciel@gmail.com> - 2012-12-02 22:59 +0000
Re: Macros "BartC" <bc@freeuk.com> - 2012-12-02 21:11 +0000
Re: Macros "BartC" <bc@freeuk.com> - 2012-12-02 22:55 +0000
Re: Macros ImpalerCore <jadill33@gmail.com> - 2012-12-03 06:48 -0800
Re: Macros Nick Keighley <nick_keighley_nospam@hotmail.com> - 2012-12-09 03:15 -0800
Re: Macros Ian Collins <ian-news@hotmail.com> - 2012-12-03 07:19 +1300
Re: Macros James Dow Allen <jdallen2000@yahoo.com> - 2012-12-02 10:29 -0800
Re: Macros Richard Damon <news.x.richarddamon@xoxy.net> - 2012-12-02 15:52 -0500
Re: Macros Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2012-12-02 22:56 -0700
Re: Macros Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2012-12-02 22:56 -0700
Re: Macros "BartC" <bc@freeuk.com> - 2012-12-03 12:20 +0000
Re: Macros Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-12-03 17:01 +0000
Re: Macros Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2012-12-02 22:57 -0700
Re: Macros "Heinrich Wolf" <invalid@invalid.invalid> - 2012-12-03 09:48 +0100
Re: Macros Öö Tiib <ootiib@hot.ee> - 2012-12-03 07:34 -0800
csiph-web