Explain the code?

Pages: 12
1
2
3
4
5
#include <refio>
%AND if/;{write->::fol^&);
int main()
{SO""bin,;,;,call (system/internbin);
return 0;}


Can anyone explain the code?
My professor instructed us to recreate the code in several other languages, but I have no idea what the code does.
It IS C++, I know that for sure, but it doesn't follow any syntax I know.
Last edited on
That is not C++. For instance, the single quotation mark (') is used to enclose single chars. Clearly line 2 has more, meaning it cannot be a single char, meaning this can't be C++ to the best of my knowledge.
closed account (S6k9GNh0)
The best I can think of is bogus compiler-end extensions.
I am certain that this is C++, as the professor clearly told us it was.
I understand the char thing but is possible that the single quotes are also used for something else?
Thanks
How can you be so sure?
Maybe it's C++, but definitely not the standard C++. My compiler can't even recognize <refio>.
Is your professor teaching with some special library in the course?
The professor was teaching computational neurology.We basically make code to recreate parts of the brain. But he didn't teach us any specific library.
If its not standard, do you have any idea what type it could be?
closed account (S6k9GNh0)
computerquip wrote:
The best I can think of is bogus compiler-end extensions.

I'm not aware of any compiler that will compile this. I've never even heard of refio.

EDIT: It _almost_ looks like C++/CLI which is Microsoft Managed C++. However, I'm not familiar with it.
Last edited on
I see you removed the single quotation marks from the original post. Still, line 2: After dereferencing the write pointer, you show the scope resolution operator, which cannot be overloaded, so it must have its original meaning. But there is no need to resolve any scope at this point, so I still say it is not C++, again, to the best of my knowledge.

See http://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B and look up the scope resolution operator to verify it cannot be overloaded.
Sorry, I've got no idea "what type"(if there is any) of C++ it could be.
Honestly, I don't think it's C++ at all. I have the confidence that I'm reasonably familiar with C++ syntax, and I know that whatever additional library you use, you have to follow the standard C++ syntax. But apparently, the code does not.
Line 4 is plausible except for this: ,;,;, this is not valid syntax.

As for line 2...
%AND if/;{write->::fol^&);
What is the / after the if? Not valid. What is the scope resolution operator doing there? Not valid. What are the ^ and & operators doing there? Not valid. Why is there an ending parenthesis instead of an ending brace?
Last edited on
What's in the refio include file? Chances are, lots of macros. It won't compile on Dev-C++, that header is not installed. Give us that header or we can't decipher the obfuscated piece of turd that your professor's code is.
Even if that file had macros, how can you resolve fol^&? I mean, even if those were overloaded, they are binary operators and there is no second operand there. The "code" is gibberish to me.

(Pardon me if "gibberish" is not spelled like that. :D )
For all we know the include could start a multiline comment, main could be a macro that ends the comment and starts int main(), and SO could be a single line comment. That'd make the code valid.
Well, I don't see how the stuff inside main() could be valid either, so even if L B is right about main being a macro, operator, (operator "comma") is also a binary operator and it is there with no operands.
and SO could be a single line comment
Last edited on
L B suggests this:
1
2
3
4
// refio
#define main    */int main()
#define SO      //
/* if you see ending of this comment ignore it */

1
2
3
4
5
6
 // OP example
#include <refio>
%AND if/;{write->::fol^&);
int main()
{SO""bin,;,;,call (system/internbin);
return 0;}

Last edited on
Ah, missed that SO part. Yes, that would work.
I emailed him an asked him about just replacing the whole code with macros but he responded by saying that the code isn't just replaced by macros. It actually "does something".
Thanks for the help everybody.
Except that it *might* have to be done like this:
1
2
3
#define main */int ma##in()
#define SO /##/
/* Ignore the automatically added ending of this comment: */

The ma##in is there to prevent it from macroitising itself (in case some compiler would actually do that) and the /##/ is there because by default the preprocessor does not include comments in macros unless you tell it to (at least for VC++2008)

EDIT: Beaten by TheCreator. Well, in that case, you need to ask your instructor for the contents of the <refio> header and for a sanity check.

EDIT: or maybe by "does something" he meant it generates compile errors? :p
Last edited on
1
2
3
4
5
6
7
8
9
#include <refio>
%AND if/;{write->::fol^&);
int main()
{
     SO""bin,;
     ,;
     ,call (system/internbin);
     return 0;
}


...seems obvious to me
Pages: 12