[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
>There are people on /g/ right now who dont know what this
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 91
Thread images: 7
File: muhcode.jpg (67 KB, 526x349) Image search: [Google]
muhcode.jpg
67 KB, 526x349
>There are people on /g/ right now who dont know what this code prints without compiling it
>>
You mean I have a life?
>>
File: 1428569593598r2.png (20 KB, 84x84) Image search: [Google]
1428569593598r2.png
20 KB, 84x84
>>52883382
but it has pointers and shit i dont even
i cant even
>>
I don't even know what that means, but then again, I have SEX.
>>
>>52883421
Literally what I thought when I saw that image.
>>
>>52883382
and why do your i's look like little L's. pig disgusting.
>>
But I do know what it says. It's says: "I write C for free."
>>
>>52883382
Nice bait, but we aren't going to solve what the programmer made.
He want's to keep his job, so he makes it difficult for you to understand his code, thus making it nearly impossible for you to maintain his code.
Tell your boss that only the original programmer can maintain it and have a nice day.
>>
>>52883382
if you wanted us to understand it why did you obfuscate it?
>>
>>52883382
>let me just waste those life minutes real quick to decipher worse possible C practices to get an answer from this
>>
>>52883564
This. It's not nice to obfuscate and waste people's times, OP. No one cares that much.
>>
Segmentation fault (core dumped)
>>
I knew what was going on up to where k was initialized, fuck everything after that
>>
ok it prints 3. yes i compiled it.. fucking faggot.
>>
it prints nothing because you cannot take the address of a literal
>>
>>52883735
oh well, nevermind
but it could print literally anything due to multiple unsequenced modifications to the same object
gg op
>>
I'll just hire an Indian for a ham sandwich and call it a day.
>>
You can't even find C that spaghetti in the linux kernel, and that's saying something
>>
File: uwotmate.jpg (18 KB, 581x114) Image search: [Google]
uwotmate.jpg
18 KB, 581x114
>>52883699
its 2
>>
>>52883382
>Believing whatever is there is worth solving

It's clearly poor practice and a waste of time to even bother trying decipher that HORSE SHIT.
>>
>>52883382
>OP as no idea what this code print without compiling and running it

http://pastebin.com/GQPnUi7d
>>
>>52883382
Of course not. It Calls a function that you didn't screencap.
>>
>>52884485
>http://pastebin.com/GQPnUi7d

What the fuck is this?

>shell code
>long jumps
>suspicious inline assembly

I ain't running that shit, nigga
>>
>>52883560
this. OP is a neet faggot who just completed his first C tutorial.
>>
File: 50314_288865372137_2985807_n.jpg (12 KB, 200x219) Image search: [Google]
50314_288865372137_2985807_n.jpg
12 KB, 200x219
>>52884537
>>
>>52884555
http://codepad.org/yGyOORHB
>>
>>52884653
>doesn't follow the instructions on top
>>
>>52883382
What the fuck do those pointers even point at? Genuine question here.
>>
File: Screenshot_2016-02-09_22-42-57.png (38 KB, 499x128) Image search: [Google]
Screenshot_2016-02-09_22-42-57.png
38 KB, 499x128
>>52883382
Guess what this does OP
CAN YOU EH?
>>
>>52884731
a[i] equals *(a+i). the name of the array is bascily &a[0].
So q will be the difference in bytes of the position of 2 and 1 in the array due to conversion to (void*). For example -4.
>>
>>52884537
Holy shit, you don't know how macro functions work?
If you look closely you see that OP defined the macro kek(i) and it returns i+i.
#define kek(i) (i+i)
>>
>>52884777
no because i dont know where "table" is pointing at and the shit inside the brackets depents on the input of fgetsc
>>
>>52883382
>unironically dealing with programming
>unironically knowing ANYTHING about it whatsoever
>not just visiting tech related spaces to hear about nice stuff to buy and some nerd shit to laugh at

lmao

got get a real degree with and ocupation with an actual demand
>>
>>52887086
You know jack shit about programming.
>>
>>52883382
I know how does it feel when my dick is in a pussy.
>>
>>52883560
>>52883595
Its not even obfrusucated well
If i wasnt on my phone id type out the deobd equivalent
>>
>>52883382
Runtime error
>>
>There are people on /g/ right now who dont know what this code prints without compiling it
var _0x2b2d=["\x69\x6E","\x56\x6F\x6C\x76\x6F","\x53\x34\x30","\x70\x72\x69\x6E\x74\x6C\x6E","\x6F\x75\x74","\x53\x74\x65\x76\x69\x6C\x6F\x20\x76\x6F\x7A\x69\x6C\x3A\x20","\x70\x72\x69\x6E\x74","\x6E\x65\x78\x74\x49\x6E\x74"];Scanner;scn_vnos= new Scanner(System[_0x2b2d[0]]);Q;a= new Q(_0x2b2d[1],_0x2b2d[2],5,50,6);System[_0x2b2d[4]][_0x2b2d[3]](a.toString());String;b,str_tip;int;num,num2=0;System[_0x2b2d[4]][_0x2b2d[6]](_0x2b2d[5]);num=scn_vnos[_0x2b2d[7]]();Q[];qa= new Q[num]
>>
>>52887656

Exactly. I actually said that in my post but seeing as you don't know how to read, that went over your head. No wonder you're a programmer lmao
>>
>>52883382
Ok I have an honest question.

What do 0[i] and 1[i] refer to?
>>
>>52884537
I laughed heartily, thanks Anon.
>>
>>52889322
It's just an alternative syntax for i[0] and i[1]. So, the first and second element in the array.
>>
>>52883382
>kek(++k)
what compiler?
>>
>>52889259
Not understanding my post, yeah your liberal arts degree shows.
>>
>>52883382
Using prefix and postfix operators like that is undefined. Read up on how the spec handles sequence points.
>>
>>52889615
>implying 0[i] isnt 0+i*sizeof(int)
>>
>>52890490
I assumed he'd know that, but yeah...
>>
int q = ((void *)&0[i])-((void *)&1[i])


Right off the bat we have some undefined behavior. Presumably, this is the difference between the memory addresses storing the first and second elements of i, but given that i is an array of int, and not of a fixed width type, then without further knowledge of the platform, I cannot know the value of q.

Doing any further work is irrelevant, because the rest of your code relies on the value of an implementation-defined integer.
>>
>>52889745
Gcc
>>
>>52890808
(Ansi) c guarantees that the adresses of a field are consecutive

Doesnt anybody here know how to program? This is litterally just 5 lines of code.
>>
>>52883382

ok i can't know what it prints without compiling it first, but are there really people who can look at obfuscated code like this and tell what it prints without manually executing it on paper or anything ??
>>
>>52890899

It does guarantee that the addresses are consecutive. It does not guarantee the size of an int is 32 bits, and on at least two platforms I can name off the top of my head, it is not. If the value of i[0] has the address 0x200000, then the value of i[1] might have an address of 0x200002, 0x200004, 0x200008, or something completely different. Taking a difference between the pointers might result in q having a value of -2, -4, -8, or something else. Furthermore, we do not have any guarantee that pointers are signed or unsigned, and that the conversion from unsigned to signed is going to give us a sane value.

>>52890954

If your time is worthless, and you have encyclopedic knowledge of the language, then yeah, you can. But the example program given by OP does rely on undefined behavior, so without some specific knowledge about the operating system, instruction set architecture, and compiler, the problem is unsolvable.
>>
>>52883382
it just prints kek
>>
>>52883382
>there are people like me who know nothing about code
>>
>>52883597
this
>>
>>52891057
>>52887086
>>52883454
>>52883394
OP is a self-important, elitist shithead trying to jack himself off at others' expense, but so are you.
>>
>>52891025
Youre right, ask whats the sizeof (int) and then ask what kind of compiler is used and you got the answer.
>>
depends on the compiler
>>
>>52883394
Where do you think we are?
>>
It's 2. Code looks like shit but you can do it of the top of your head. And all the c I know comes from arduino.
>>
>>52891111
>i cant figure out the answer
>>
>>52884485
what does this really do
>>
>>52883382
noob here like the fuck kek(++k) returns 2 when I test it
>>
>>52892167
kek(++k) becomes (++k) + (++k)
>>
>>52892167
>>52892254
>kek(++k) becomes (++k) + (++k)
then, notice that there is also a --k, so k gets -1 at first then 0 then 1 and then you add those 1s
>>
>>52892546
I see so in c/c++ the two (++k) in (++k) + (++k) are incremented at the same time and in other languages like Java they are incremented one by one
>>
>>52891111
I was just saying hes right because I know literally nothing about code
>>
>>52883382
Nice undefined behaviour if you built for x64 faggot
>>
I can't even compile it
notepad.cpp:11:40: error: invalid use of 'void'
int q = ((void *)&0[i])-((void *)&1[i]);
>>
>>52884485
>http://pastebin.com/GQPnUi7d
jesus fucking christ
>>
>>52893591
this is not related to your error but did you see any std:cout or any c++ features in the code to name your file .cpp ?
>>
>>52883382
>>52883854
>>52888714
I may be a C noob, but what compiler actually allows this?
>kek(++k) processes to (++k + ++k), which modifies k twice between sequence points
>>
>>52895399

it's valid C and all compilers allow it

you can write that as

k+=1;
k+=1;
( k + k ) ;


the two post incrementation have the same priority and both have a higher priority that the + operator
>>
File: xD.jpg (1 MB, 8000x8000) Image search: [Google]
xD.jpg
1 MB, 8000x8000
LMFGAO DFSASDFDFSHJSDFA ASDFHJASDFKLASDF SDF LOL BRO XD HILARIOUS SO FUNNY JESUS LOL I LOVE YOU REDDIT
>>
File: 1365729877806.jpg (115 KB, 591x530) Image search: [Google]
1365729877806.jpg
115 KB, 591x530
>>52883382
>Non-descriptive variable names

I don't know what it prints because I would throw it into the trash as soon as I saw that. Get good.
>>
>>52883382
You can't take the address of an integer literal.
This program won't compile.
>>
>>52892815
>incremented at the same time
the fuck are you trying to say here? k is only one value, getting incremented once, then getting incremented again, by the prefix operator. The operator precedence isn't different than Java in this case.
>>
>>52896287

1[i] is the same as i[1] and *(i+1)
>>
>>52895780
It is undefined by the standard.
>>
>>52895780
no it isn't like this.
It may aswell do (which it actually should):
 k = k + 1;
t1 = k;
k = k + 1;
t2 = k;
return (t1 + t2);

Because the values are evaluated from right to left.
And the preincrement will have effect the moment it is evaluated and not when the line is reached.

This is implementation dependend though and the compiler can do whatever the fuck it wants to do
>>
>>52883382
That code looks like a git blame and an email to whomever spawned that monstrocity.

I work in C, but they don't pay me to puzzle out obfuscated code. No sense wasting their money.
>>
http://pastebin.com/AMVN6BUY
> there are people on /g/ right now who don't know what this code does without running it
>>
>>52896790
https://repl.it/Bl0Y/0
wat
>>
>>52896804
i guess i should have said, don't know what this lambda does without applying it to some input

specifying a valid input would ruin the puzzle
>>
>>52896804
>>52896819
also forgot at least one helper function definition fug

that's what you get for posting years old code
>>
>>52896846
I'll bite... What's the interesting thing going on here?
>>
>>52896896
wrote a brainfuck interpreter in racket and translated it into lambda calculus (minus a helper function or two).

probably inlined a bunch of the lambdas judging by it's size but i don't remember anymore
>>
>>52896911
Haha I hope you got a real job since then?
>>
>>52896916
that's pretty much exactly what happened
>>
that font is gay, how can you even stand that shit
>>
>>52883382
it prints retards shouldn't use pointers retardedly
Thread replies: 91
Thread images: 7

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.