flat assembler
Message board for the users of flat assembler.

Index > Heap > Comments are syntactical GOTO

Author
Thread Post new topic Reply to topic
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr
Hi there!

In many programming languages there are two kinds of comments: block (/**/) and end-of-line (//). They could be used for fun (and profit, yeah ;-)).
Code:
//* in if-else terms, this is "then" part ;-)
a = 0;
/*/// this is "else" part
a = 1;
//*/    
As you may already devised, after that chunk of code a == 0. With a flick of a finger, deletion of single leading (or following it, whatever you prefer) slash turns it to
Code:
/* f2k, I'm commented again ;-)
a = 0;
/*/// "else" part is going to do something
a = 1;
//*/    
which makes a == 1. Those languages that have nested comment allow to have more fun.

P.S. Those two slashes after "/*/" thingy was just for comment (and fun, and profit as well ;-))
Post 14 Sep 2012, 16:06
View user's profile Send private message Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1408
Location: Toronto, Canada
AsmGuru62
Yeah... these are "fun" to understand.
And I yet need to find an IDE which can properly highlight these too.
IMO it is better to select a few lines as a block and comment/uncomment
using usual ';' at the beginning of every line.
Post 14 Sep 2012, 18:14
View user's profile Send private message Send e-mail Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr
AsmGuru62,

It looks like you don't read subject yet. Wink

In Lua, you can do something like that:
Code:
--[==[ <= this controls almost everything
--  The idea: skip to corresponding block, use "--[[" to skip rest
--  Space between opening "--[[" and "]=…=]" can be used for comments
--  "[=…=[" can be inserted right after "--" and before "]]" to link blocks like directed graph
--]]
--[[
  block 1 
]=] print "v1" --]]
--[[ block 2 ]==]
print "v2"
--[=[ chain to block 1.2 ]] print "not v2"
--[[ block 3 ]===]
print "v3"
--]] print "v2!"
--[[ block 1.2 ]=] print "v1.2" --]]
print "done"    
Post 14 Sep 2012, 20:52
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2913
Location: 0x77760000
typedef
I like the way assembly is.

Everything is one line at a time. Wink

I think I'm good with that.
Post 14 Sep 2012, 21:03
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.