What is this type of code called?

Everything else that doesn't fall into one of the other PB categories.
Nituvious
Addict
Addict
Posts: 1033
Joined: Sat Jul 11, 2009 4:57 am
Location: United States

What is this type of code called?

Post by Nituvious »

I asked a programming friend of mine what this is that I made and he said it sounded like self modifying code, however he didn't really understand what it was I had even done. Maybe some of you guys know and can tell me.

I call it useless, but I would really like to know.

Code: Select all

Macro CreateConstant(ConstantName, Value)
	#ConstantName = Value
EndMacro

CreateConstant(MyConstant, 1)
CreateConstant(MyButton, 2)

OpenWindow(#MyConstant, 0, 0, 200, 200, "Useless code in action!", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
ButtonGadget(#MyButton, 5, 5, 100, 50, "Some Button")

Repeat
	Delay(10)

	If WaitWindowEvent(1) = #PB_Event_Gadget
		Select EventGadget()
			Case #MyButton
				MessageRequester("Message","Useless, I know")
		EndSelect
	EndIf

Until WaitWindowEvent(1) = #PB_Event_CloseWindow
▓▓▓▓▓▒▒▒▒▒░░░░░
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Re: What is this type of code called?

Post by Trond »

It's just normal use of macros, it doesn't have a special name.
Nituvious
Addict
Addict
Posts: 1033
Joined: Sat Jul 11, 2009 4:57 am
Location: United States

Re: What is this type of code called?

Post by Nituvious »

Figured :mrgreen:
▓▓▓▓▓▒▒▒▒▒░░░░░
User avatar
JackWebb
Enthusiast
Enthusiast
Posts: 115
Joined: Wed Dec 16, 2009 1:42 pm
Location: Tampa Florida

Re: What is this type of code called?

Post by JackWebb »

The code you posted does not appear to be self modifying, but if it were it would be called PolyMorphic.

http://en.wikipedia.org/wiki/Polymorphic_code
Make everything as simple as possible, but not simpler. ~Albert Einstein
Post Reply