C++

I've never had any formal training, I was wondering if there is a better / more efficient way to define this shit. I feel like I'm currently doing stuff the cs graduate meme way.

Attached: 900megsofarray.jpg (1484x657, 324K)

What the fuck is this? Make a matrix?

I have to break up the data otherwise stack overflow

fuck, instArraySize is actually 3538944 It's calculated normally and I botched them when I wrote it for the screen shot

Why are you Not simply increasing the stacksize? Put this shit in a 2D array

stack size is at 400000000. Also it makes it easier to break it all up for calculations on separate bits later on.

Perhaps this?

float* mesh = new float[78 * instArraySize];


And then access with:

mesh[(y * instArraySize) + x]


And when you're done with it, free the memory with:

delete[] mesh;

Is it okay to go 1gig for stack size if I want to 2d array this shit?

holy shit, how come this didn't stack overflow?

You shouldn't be allocating big stuff on the stack indeed. You could use malloc which is hidden under "new" in C++ or make it global like you do. I think you could make it a two dimensional array to make it look less like cs graduate meme.
float mesh[78][instArraySize];


The data was allocated on the heap, not on the stack.

Why do you need to put all this shit on the stack? Are you scared of the heap and stdlib?

What exactly are you doing? I'm asking this because it's almost never wise to try to load all your data at once like this unless you actually need to. I highly doubt you're doing a computation that requires all these arrays at once. You might think you're be saving time on disk IO or something, but the gains are probably negligible.

People don't use enormous stack allocated C arrays very much. It's not a good idea because it isn't scalable, the point at which it overflows is not guaranteed across platforms and if instArraySize isn't a constant you've got a Variable Length Array, which is invalid in C++ (it'll compile in GCC and maybe some others because they have compiler extensions that allow it, but again it's not portable).

What I've written there is the heap allocation solution, you need to make sure you call that delete when you no longer need the data or you've got a memory leak.

Nigga what the fuck.
Use the STL.

>I've never had any formal training
Well, get some.
Read a fucking book, you nigger. That is all the formal training in the world.
K&R is the starting place.

>Use the STL.
No. He should simply learn what the fuck he is doing.

>Are you scared of the heap and stdlib
yep. I guess that has to change.
thanks man. I guess I need to read up on heap vs stack. Not something I'm really familiar with.
up until now I've not really run into anything I couldn't just figure out.

beautiful

>>Are you scared of the heap and stdlib
>yep

Attached: 1312828225003.jpg (289x292, 13K)

Attached: csdegree.png (1413x993, 774K)

nooooooooooooooooooooooooo I never wanted to be a meme.

>up until now I've not really run into anything I couldn't just figure out.
If you write code like this you apparently haven't figured out how to not be gigantic faggot.
GO READ A BOOK YOU NIGGER.
This is the most gay shit I have read in a long time.
You must be literally braindead if you think this is a good idea.
"programmers" were a mistake.

Start using the heap when working with big data.

So this is what happens when you learn to kode without university or at least a good book?

kek.

just fucking use 2D array

Because you're trying to load a shitton of variables into a tiny CPU cache instead of the main system memory.

vector mesh(78,vector(13824));

Stack is actually stored in RAM.
float, not int. But that's how you're supposed to do it.

I just purchased the c programming language. It better give me super powers. Also, chill mate. I'm just a guy and so are you. No need to be a finger pointer. That's Californian as fuck.
it was actually 3538944 not 13824.

I used mostly C instead of C++. A few times I've seen people on stackoverflow and the like saying that making a vector of vectors is a bad way to make matrices in C++, why is that?

>it was actually 3538944 not 13824.
It's 78*13824, I though he needed a matrix.
There's no good way to make 2d arrays in C/C++. Vector of vectors is bad for the same reason the double pointer way is bad - you waste the memory on pointers.

And if you don't actually need a matrix here you just
vector mesh(3538944);
it won't overflow or anything.

>(78, vector(13824))
The 2nd parameter specifies the "value" that those 78 elements are initiated with right?

>this is the power of sepples posters
post this question on SO so you can trigger everyone before your question gets deleted

>It's 78*13824, I though he needed a matrix.
64 * 3538944. 2d array is probably easiest to manage in other parts of the program.
sorry didn't realize vectors were heap as well.

You guys should see my website, every php file is filled with code like this and are 3k+ lines long
It gets the job done though

Attached: code.png (590x919, 146K)

Attached: 1513034079917.png (185x233, 29K)

Yes.

What? No, you're just as dumb as OP is. Stacks live in memory, that's not the problem. They're just finite in size because they use contiguous addresses so they have to be allocated up front. This is the same problem as recursing too deep. You run out of space.

holy shit why?
You say you need to store a lot of floats, but this has to be the worst possible way to do it.
You don't have to describe your entire project, but at least give an example of why you would ever need this.

Dumb Windows faggot.
It expands on Linux.

This is why you shouldn't use vim.

crash course in sepples
keyword new means allocate this thing on the heap. It doesn't matter what, you could allocate fucking ints on the heap. Every call to new MUST be matched with a delete.

If you're unfamiliar with how computers handle memory, I'd look into implementing a non-trivial project in any assembly language, but ARM or MIPS would probably be easiest. Also read a book, any book will do

In which way is this particular monstrosity typical for vim users?

Do you think this is written manually?

no, but surely many modern editors support spamming infinity lines with incrementing numbers?

At the very least put a leading zeros in order to make them align you fuckwit.

It was.

Do you think people dumb enough to write such code can learn vim?

lies.
Yes. Learning vim is easy, it would not take a lot of time to write this if all you knew was vim.
It all depends on when it was written. It is not a common IDE feature, and it is not the first thing you learn when you use other editors.
I don't personally know anyone dumb enough to write code like that, but if such a person exist, they probably be a vim user.

>const
use constexpr

constexpr static size_t instArraySize = 3538944;
constexpr static size_t meshesSize = 0100; //the leading 0 makes it octal so it's actually 64
float mesh[meshesSize][instArraySize];


>78

To be fair, reading half of the first line was probably enough for them to understand the joke.
Looking at it long enough to see how much of a failure OP is, is a good reason why you want to program properly.

>//the leading 0 makes it octal
holy fuck i always thought it was the letter 'o' but i always wrote shit in hex or binary instead
i am a brainlet

That's Atom
Source: I wrote it

get your shit together user.

Attached: 1372861678356.jpg (320x335, 21K)

>just purchased
but why?

Attached: Screen Shot 2018-04-28 at 9.31.29 PM.png (282x298, 117K)

>Look mom I said it again!

Attached: 1494167665321.png (671x519, 146K)

I really really really hope you just made that to bait people

Attached: tired.jpg (482x427, 36K)

this sort of low mental capacity is why he needs the book in the first place

if he knew how to google he would be set

Attached: derrrrrr.jpg (588x600, 89K)

quints speak the truth, verily I'm honored

Attached: 1522136265635.png (564x708, 509K)

not him but I don't feel comfy reading a PDF in desktop. I kinda get distracted easily too.

Understandable, I'm the same way. But free is free, and he may not even find it valuable.

Why... just why...

Attached: 1519650202478.png (600x600, 373K)

You can get goopy shit on Amazon for a buck, I'm sure raw chicken breasts are more expensive

I prefer paper. I did download it and skim a bit before deciding to purchase it.

My sides. This is the reason why I lurk Jow Forums.

Are you retarded by any chance?
Also KYS
Also read a book

float mesh[78][instArraySize];

Are you brain damaged?