From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,fc52c633190162e0 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Newsgroups: comp.lang.ada Subject: Re: why learn C? References: <1172144043.746296.44680@m58g2000cwm.googlegroups.com> <1172161751.573558.24140@h3g2000cwc.googlegroups.com> <546qkhF1tr7dtU1@mid.individual.net> <5ZULh.48$YL5.40@newssvr29.news.prodigy.net> <1175215906.645110.217810@e65g2000hsc.googlegroups.com> <1175230352.808212.15550@e65g2000hsc.googlegroups.com> <1175236212.771445.135460@y66g2000hsf.googlegroups.com> <1175308871.266257.77460@e65g2000hsc.googlegroups.com> <1175501602.127760.186120@q75g2000hsh.googlegroups.com> <1yveg1eads.fsf@hod.lan.m-e-leypold.de> From: Markus E Leypold Organization: N/A Date: Sun, 15 Apr 2007 17:25:37 +0200 Message-ID: <9a647x8xse.fsf@hod.lan.m-e-leypold.de> User-Agent: Some cool user agent (SCUG) Cancel-Lock: sha1:R5BDEvqG2B38XdHtRFnEHpyRDc0= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii NNTP-Posting-Host: 88.72.204.228 X-Trace: news.arcor-ip.de 1176650287 88.72.204.228 (15 Apr 2007 17:18:07 +0200) X-Complaints-To: abuse@arcor-ip.de Path: g2news1.google.com!news1.google.com!news.glorb.com!news2.arglkargh.de!news.visyn.net!news-fra1.dfn.de!newsfeed.arcor-ip.de!news.arcor-ip.de!not-for-mail Xref: g2news1.google.com comp.lang.ada:15042 Date: 2007-04-15T17:25:37+02:00 List-Id: Hyman Rosen writes: > Markus E Leypold wrote: >> This is only necessary because C/C++ has no way to specify a >> constant array (i.e. a "array literal"). > > Not really. The preprocessor stuff is generating program code as > well as data. Think about "properties" - you need to code a getter, > a setter, a place to hold the value, a type, a descriptive string, > and so forth. The language syntax may not allow all of this to be > in one place, and that's where macros can come in handy. Oooh -- don't know. In reality I found that if I really abstract of attributes of objects (or ADTs in general), the attribute has no 1:1 representation in the implementation. Getting and setting become fundamentally different then: i'd have to implement them separately anyway. And often I only want to export the attribute read-only (indeed that is the often default in base classes anyway), so I don't want to provide a setter. Some "setter functions" don't even make much sense when setting a single attribute. So overall I found I can well forgo using the pre processor like this. And custom syntax should anyway be used very sparingly and only if you do something really different or new AND know what you're doing: Else the program becomes quickly unreadable locally. And most people with a pre processor at their finger tipps don't realize that they shouldn't and -- well -- the results a regrettable. Regards -- Markus