🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #180632

Re: The _Good_ aesthetics of macros.

#180632
From: The Ghost In The Machine
Date: Sat, 18 Feb 2006 00:00
95 lines
4110 bytes
In comp.os.linux.advocacy, Jeff_?elf
<Me@Privacy.NET>
 wrote
on 17 Feb 2006 22:23:56 GMT
<Jeff_Relf_2006_Feb_17_cM10@Cotse.NET>:
> Hi  Ghost_In_The_Machine,  You say your copy of X.CPP only has 1,321 lines ?
> Mine has 2,077 and it's UTF-16 encoded, Cotse.NET/users/jeffrelf/X.CPP

I did say it was an older variant.  At least you put a
proper UTF-16 header (0xFF 0xFE) on the file so that I have a
chance of converting it to something vaguely readable.  :-P

Herewith my Java program for doing so (in case anyone else really
needs to convert a UTF-16 X.CPP file variant into something vaguely
resembling ASCII):

  import java.io.*;

  public class Uconv
  {
    public static void main(String[] args) throws IOException
    {
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      byte[] b = new byte[1024];
      int n;

      while((n = System.in.read(b)) > 0)
        baos.write(b, 0,n);

      baos.close();

      String inp = new String(baos.toByteArray(), "UTF-16");

      System.out.write(inp.getBytes("UTF-8"));
    }
  }

A little moronic but the more obvious variants I tried weren't working.

I now count macrodefs from line 23 to line 154.  A lot of
L"" constructs; the C++ constructs

wchar_t * ptr = L"Hello, world!";

std::wcout << ptr;

handle these without difficulty, in the Gnu world.

>
> Also, I think you'll find a lot more than 80 lines of macros.

I count 132 lines of macrodefs.  Many of these are multiline.

> Still, I do go way out of my way avoid them at _Certain_ times.
> Here's a recent macro I wrote for another program:
>
>   HWND Button_Windows [ 99 ];  //  99 is just an simple example.
>   #define  CW  CreateWindowExW
>   #define  CB  Button_Windows [ Total_Buttons ++ ] = CW ( 0, L"BUTTON",
>
> It creates a button and is called like this:
>
>   CB  "A Button Title", Flags, X, Y, Width, Hight
>   , Parent_Window, ( HMENU ) 2, PID, 0 );
>
> Does that blow your mind or what... ?

It's a good thing you used upper case in this example.  I now count
*five* looping variants, although to be fair LoopPrn() looks
more specialized than LOOP, Loop, LoopTo, and LoopXx.

And then there's StrCmp, Eq, Eqi, EqN, _EqN, EqiN, and _EqiN.

Absolutely bloody amazing.

>
> I wrote:
>
>   Things like:  struct Some_Type { int X ; };  func( Some_Type & Buff ) { ... }  
>   are a good way to avoid ugly -> operators and macros.
>
> And you replied:  Don't like the 'pointto' operator, eh ?
>
> Yes, I'm big on aesthetics like that.
> Macros reduce the size of the source code 
> and avoid having to look at ugly repetition, for example.
>

Repetition is definitely not your problem, in X.CPP... :-)

-- 
#191, ewill3@earthlink.net
It's still legal to go .sigless.

Technical Details
Message-ID: <084ic3-ur4.ln1@sirius.tg00suus7038.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-sci.physics.(1199963).mbox.7z!not-for-mail
References: <Jeff_Relf_2006_Feb_16_KK6Y@Cotse.NET> <himec3-r2h.ln1@sirius.tg00suus7038.net> <Jeff_Relf_2006_Feb_16_nvkC@Cotse.NET> <r05fc3-5di.ln1@sirius.tg00suus7038.net> <Jeff_Relf_2006_Feb_16_e5gd@Cotse.NET> <0efhc3-n7f.ln1@sirius.tg00suus7038.net> <Jeff_Relf_2006_Feb_17_cM10@Cotse.NET>

Show Full Headers
Complete Article Headers
Message-ID: <084ic3-ur4.ln1@sirius.tg00suus7038.net>
Subject: Re: The _Good_ aesthetics of macros.
Date: Sat, 18 Feb 2006 00:00:15 GMT
From: The Ghost In The Machine <ewill@sirius.tg00suus7038.net>
References: <Jeff_Relf_2006_Feb_16_KK6Y@Cotse.NET> <himec3-r2h.ln1@sirius.tg00suus7038.net> <Jeff_Relf_2006_Feb_16_nvkC@Cotse.NET> <r05fc3-5di.ln1@sirius.tg00suus7038.net> <Jeff_Relf_2006_Feb_16_e5gd@Cotse.NET> <0efhc3-n7f.ln1@sirius.tg00suus7038.net> <Jeff_Relf_2006_Feb_17_cM10@Cotse.NET>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-sci.physics.(1199963).mbox.7z!not-for-mail
Newsgroups: news.software.readers,sci.physics,comp.os.linux.advocacy
X-face: "i;@/WO(?;[KC9sW;wG/4@H[_VFFH4?QHJ#O(?m}7fQMrJ,]0THA'\|e-EPG_>56Mi}_RRhBS'a2}u_7jm)0_+'=$V#E2r4#IQE/d)yMv3_4@hl<)mA&*tDN/
User-Agent: slrn/0.9.8.1 (Linux)
Lines: 93
NNTP-Posting-Host: 63.13.225.130
X-Complaints-To: abuse@earthlink.net
X-Trace: newsread2.news.atl.earthlink.net 1140220815 63.13.225.130 (Fri, 17 Feb 2006 16:00:15 PST)
NNTP-Posting-Date: Fri, 17 Feb 2006 16:00:15 PST
Organization: EarthLink Inc. -- http://www.EarthLink.net