Your interviewer asks you what this piece of code does and why it's a good thing to run on CPUs and RAM. What is your response?
Let's see if anyone on Sup Forums has a job because if you can't read and understand this simple piece of code, you will never get a decent job.
Noah Evans
I'd tell him to do his wife's son's homework himself and then turn 360 degrees and walk way
Aaron Mitchell
I got the job simply by getting dubz, as I'm about to show you right now.
Camden Baker
Pathetic, I'm powered by the singles. The doubles only increase my extremeness, witness my digits
Colton Wilson
It's a waste of time is what the code is. There's no reason to run it.
Gavin Thompson
360 degrees and you still looking toward him you mongoloid
Logan Foster
t. brainlet NEET
t. unemployed
David Powell
I can read it and understand it. I'm just not doing your homework
Jose Young
newfag
Benjamin Rogers
I know what the code is doing, it's just a waste of time.
There's no benefit to be running it, so it's not "a good thing to run on CPUs and RAM".
Benjamin Davis
It figures out the max alloc size possible right?
Christian Richardson
do your own homework.
Kevin Williams
>if you are not pajeet codemonkey, you are unemployed
Michael Harris
Even if you can't answer the OP, you'd be stupid to take what he says to heart.
Adrian Green
"Is that your final answer" - inrerviewer
Blake Gray
idk
probably dubs threads can't get because the gpu can only do single precision, so no dubs_get()
Levi Price
>notice stdafx.h >get up and leave
Nicholas Gonzalez
Lol
Adam Barnes
>Sup Forums can't pass a simple interview
lsl
Asher Phillips
nigga i get paid 25k a year copy pasting code from stack overflow
Jose Turner
It doesn't do much of anything. Just some prints, and mallocs some space for a while, but its not modified
Jack Rodriguez
it doesn't display anything because x = 0. but it's a good thing to run on cpu and ram because it shows how much memory is available
Kevin Thomas
>int x = 0; ... >return x;
This code is so fucking shit. Did you write it yoruself?
Leo Hall
>casting the return value of malloc() Stand up and leave the interview.
Ryder Ortiz
Think about what he said. Turn 360 degrees, aka an Pirouette, and THEN he walks away.
Daniel Smith
>Using windows to compile C code kys
Thomas Morris
How would you tell?
t. curious guy
Ethan Ortiz
I don't know C.
Nathaniel Cruz
>casting malloc huh??
Jaxson Miller
I-I applied for the machine learning engineer role where are the data
John Jackson
It doesn't though.
You have to input the memory space it will use, it will attempt to allocate that amount of memory, if it fails then it dumps out. If it succeeds then it just runs repeat * 1000000 loops and then frees the memory and dumps out.
It's not doing shit. It's just wasting time.
Ryder Martinez
Tell him that his unvalidated atoi call could lead to an int overflow.
Also, this:
Nathan Martinez
>calling malloc with command line arguments what a fucking retard
Asher Turner
it does nothing useful and returns 0, that's what it does
>casting malloc CEASE
Wyatt Collins
It creates an array then increments every 16th element of it, when it reaches the end it wraps around. >it's a good thing to run on CPUs and RAM As opposed to what? Running on eggs and ham?
Camden Cook
>7-space indents what the fuck
Justin Turner
It's a trick question. What the code does should be provided in the documentation.
Christian Richardson
does it simply benchmark memory access by accessing every 16 elements in the array a million times and repeat that the given number of times and report the sum, starting over from the first element if it rolls over the end of the array?
I see no other reason than benchmarking to run this
Joshua Long
jesus fucking christ pick a parenthesis styling guide and stick to it.
Do one or the other but not both you heathen
Charles Thompson
>please Sup Forums do my homework!
Nathaniel Peterson
>index -= areasize This code shows that its author is a fucking idiot. stdafx
Brayden Morales
I bet someone from Sup Forums used this line to an interviewer.
Isaiah Price
I thought that was K&R. Newline on opening bracket for functions but not if statements or loops.
Gabriel Butler
>working in the tech industry ONE MILLION KEKS. I would never step foot in this industry user. I have standards you know
Christian Barnes
K&R is shit style though
Parker Lewis
>why it's a good thing to run on CPUs and RAM. it is NOT.
Julian Baker
/thread
Xavier Turner
t. NEET
Leo Gray
>trying to defend your shitty code by calling anyone who says that it is shit unemployed
No, we aren't going to tell you how to fix it either. It's doing a perfectly good job at being useless.
Alexander Smith
You realize the code is publically available for everyone and it works but it's a terrible written code.
Kevin Hall
>making minimum wage
Xavier Scott
this Fuck winblows
Angel Edwards
"Works" is a very loose term. Does it compile and run? Sure. Does it do what the author intended? Probably not.
Jayden Clark
>areasize = (kb * 1024) / sizeof(int) ... >area = malloc(areasize * sizeof(int)) stopped reading right there
Luis Nguyen
Garbage code, someone needs a linter and why the fuck are you using malloc? Any open source code base scanner will tell you that is fucking dumb.
Ryan Hill
I can only assume that he is trying to prevent overflows, but I would have thought that malloc would overflow anyway.
Carter Gomez
>what this piece of code does fucking nothing
Jordan Davis
alright I'll be that guy, what does it do?
Nathaniel Harris
It looks like it mallocs an array of ints, then increments every 16th int, then wraps around
Not sure why this piece of shit does it 1 million times or why it only increments every 16th
David Perry
Gives you good grades in school for a correct answer
Camden Rodriguez
With -O3 it would probably exit immediately.
Parker Thompson
>"Finished reading!\n" nigga, finished reading what? The more I look at this the worse I feel. Is that what this is supposed to do? Make me feel bad?
Jeremiah Myers
every 512 bits treat 32 bits as an integer and increment by 1000000, then delete everything
I have absolutely no clue. might be a new encryption scheme. I bet the nsa will take ages to figure that one out.
Connor Gonzalez
apologies, I am mistaken. 62500 / areasize. not 1000000
Benjamin Walker
>that include order >using atof and atoi enjoy your unhandled errors >printing error messages to stdout that's what stderr is for >#define in middle of source code just why the index overflow doesn't work when areasize is smaller than half of STEP, use modulo
Overall it does nothing, the only thing it returns is exit value 0/1 and few meaningless strings. It really just wastes CPU and RAM.
Bentley Bell
Lurk more newfag. Don't ever let me see you posting here again
Jaxon Morgan
>suffering from terminal autism huh... life must be tough
Charles Nelson
>t. NEET No, I am a university student, but my Processor and RAM is too valuable for me to run your shitty code on.
Ayden Evans
Quality code, OP
Noah Ross
...
John Gonzalez
#include #include
void main() { char *s = "gas OP"; uchar *area;
area = malloc(sizeof s); if(area == nil) exits("आप यह अफसोस करने के लिए रहते हैं"); memcpy(area, s, sizeof s); free(area); exits(nil); }
Gabriel Peterson
>#include >#include
Carter Morgan
/thread
Cooper Ortiz
rabbit you are my strongest ally
Kayden Rodriguez
You need to do so if you want to compile with a C++ compiler.
Jaxon Anderson
>compiling c with c++ compiler why
Aaron Phillips
What is that even supposed to do? Store memory in a CPU and RAM and then get rid of it? For what fucking purpose?
Liam Cook
>and why it's a good thing to run on CPUs and RAM. is there supposed to be some other way to run it?
Owen Phillips
What else could he use if not malloc? Direct system calls?
Hudson Young
>using malloc deprecated code
Nathaniel Perry
fucking amateur
Jack Perry
do your own homework cs pajeet
Jose Ramirez
I would wonder how the interviewer himself got his job.
Daniel Turner
kek well said
Jordan Murphy
Also this code has a bug in it too
Landon Turner
It does nothing, really, as far as the user is concerned. But if you want to be pedantic, what it does to the RAM it uses is quite simple, it keeps incrementing every STEP long, wrapping the index around when it reaches the end. If "area" size is a multiple of STEP, the same elements are incremented each time. If not, it swifts according to the modulo of the two values.
Jayden Richardson
>why it's a good thing to run on CPUs and RAM. What is your response? This is the kind if question asked by people who define "their" way of doing things as the right way. This code might be a useful way to do benchmark ram, but useful and good are two separate things.