🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.c.moderated
3 messages
3 total messages Started by Marcel van Kervinck Thu, 11 Apr 1996 00:55
Common way to obfuscate?
#2571
Author: Marcel van Kervinck
Date: Thu, 11 Apr 1996 00:55
17 lines
718 bytes
I just recovered from a slight shock caused by realizing that
one could legally rewrite

	a[b[c]]

as

	c[b][a]

Is this a common way to obfuscate code?

Regards,
	Marcel
--  _   _
  _| |_|_|
 |_    |_     Marcel van Kervinck
         |_|  buex95a@urc.tue.nl
Re: Common way to obfuscate?
#2568
Author: Tim Hollebeek
Date: Thu, 11 Apr 1996 01:59
15 lines
1185 bytes
Marcel van Kervinck (buex95a@urc.tue.nl) wrote:
: I just recovered from a slight shock caused by realizing that
: one could legally rewrite 'a[b[c]]' as 'c[b][a]'

Right, since they are both *(a + *(b + c)).  Cute.

: Is this a common way to obfuscate code?

Wouldn't know.  I strive to write clear code :-)

---------------------------------------------------------------------------
Tim Hollebeek         | Disclaimer :=> Everything above is a true statement,
Electron Psychologist |                for sufficiently false values of true.
Princeton University  | email: tim@wfn-shop.princeton.edu
----------------------| http://wfn-shop.princeton.edu/~tim (NEW! IMPROVED!)
Re: Common way to obfuscate?
#2596
Author: Nick Maclaren
Date: Mon, 15 Apr 1996 18:08
26 lines
1525 bytes
In article <4khp20$pt@solutions.solon.com>, tim@franck.Princeton.EDU (Tim Hollebeek) writes:
|> Marcel van Kervinck (buex95a@urc.tue.nl) wrote:
|> : I just recovered from a slight shock caused by realizing that
|> : one could legally rewrite 'a[b[c]]' as 'c[b][a]'
|> 
|> Right, since they are both *(a + *(b + c)).  Cute.

This is one of the bizarrer aspects of C's history.  The equivalence
comes from BCPL which, being typeless, a[b] and b[a] (actually a!b
and b!a) were naturally the same.  I have no idea how it survived the
language changes from BCPL to B and then C!

|> : Is this a common way to obfuscate code?
|> 
|> Wouldn't know.  I strive to write clear code :-)

In BCPL, it was quite clear.  I believe that its only use in C is
deliberately to obfuscate code, and I have never seen it used even
in the worst macroid programs.


Nick Maclaren,
University of Cambridge Computer Laboratory,
New Museums Site, Pembroke Street, Cambridge CB2 3QG, England.
Email:  nmm1@cam.ac.uk
Tel.:  +44 1223 334761    Fax:  +44 1223 334679
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads