i am attempting to create a 2d array in a program using the win32 sdk.
i can create the array if it's a small size, but if it's a large size, it compiles but the program does not appear when run.
my (mis)understanding is that malloc is relegated to c and not necessary for c++. i presume this is the issue.
the array i am attempting to declare is
unsigned short int map[2048][1920];
please tell me, what is the correct way to declare this so that the program runs? :)
........................
here is my introduction, which is completely unnecessary to the topic
i have been programming for over 3 decades, starting with basic on a tandy coco
about ten years ago i tried to get into c++ for windows. this is a sob story so get yer hanky ready.
i am well known for my music software apps. eg. sound on sound magazine had some positive things to say about me. i've won awards in the music industry by popular vote. i'm a creative person!
BUT - it took me about seven years from the time i intended to code music apps until i could release one. i don't like money, money doesn't like me, and people who like money don't like me either.
apparently what this translates to is that i could have been coding and contributing several years before i did if someone had taken the time to fill me in on the things that weren't obvious to me. i can't afford school, i can rarely afford texts.
i am still using borland's free command line tools. laugh at me, go on! considering the size of the fclt installation vs. msvc express and the fact that neither of them have any decent free documentation, i'm as well off with one as the other, and fclt quite often compiles faster code than vce, at about 1/1000th of the install size.
i'd *love* to find someone who uses fclt who considers my potential to contribute important enough to explain how to compile a .dll with fclt!
the c++ programming i have done has all been dsp with the synthedit sdk. i've never had to be concerned with the size of the array i am using. don't ask me why, it just works. i have accomplished "amazing" things. i am well known for my physical modeling synthesis algorithms, which seem to be beyond the conception of most other coders in the industry. so i'm not a moron.
the malloc information i can find for c++ all pertains to pointers. i know i can use a pointer to reference an array, but i don't want to. the 2 dimensional reference is more convenient.
anyway..... i'm hoping, seeing the number of posts today in this forum, that my queries won't be ignored or dismissed.
i compiled my first c++ win sdk programs with vce about two years ago. i despise vce. all i needed to do to compile them with fclt was add -tW to my compile instruction.
i really really really wish that someone had taken the time to answer that question for me two years ago. i'm basically pissing away my life and anything i have to offer here because i can't afford to buy whatever compiler actually comes with clear information on using it. i have a lot of anger about this issue :) charles petzold's text on the win32 sdk is so obfuscated (eg. there is an entire chapter about the mouse, but it is in an entirely different chapter where the apprehension of mouseclicks is explained, so that you have to read the entire 1200 page text, and have it all fresh in your mind in order to apply it.
many people could contribute creatively, but petzold's book, for example, seems designed to lead any would-be programmers astray. i don't know what special club you have to be in to get straight information, but i am not in it, and i wouldn't join, by principle.
i do not believe that humans are lazy by nature. i beleive that humans are made deceitful and extricative by society and that they are born with the natural inclination to be cooperative, synergetic, and loving. petzolds text, for example, wants to make would-be programmers into sociopathic mass murderers.
you put the part about using mouse clicks in the chapter on the mouse. logical, yes? i think so.
thank you for your attention - it is the most valuable commodity on the planet, and i certainly respect it when the finite nature of my own attention is respected.
i would love to do things with my life before i grow old and die.
hi, i've been using 2d arrays for decades. please bear with me here -
i am declaring the array inside WndProc.
if the array is small, the program works. if the array is above a certain size, when one clicks on the icon to run the program, nothing happens. the program does not execute, or it executes and vanishes instantly. i cannot tell.
it works if i declare it outside WndProc, but i don't need the array to be available outside of WndProc, and i am mystified as to why it balks at a certain size and would like to know what i can do about it :)
(i should note that when i posted the initial enquiry, i had not tried declaring the array outside of WndProc, as i was used to declaring all WndProc variables in that scope. thanks for the response anyway, and i realise i should have mentioned the scope being WndProc initially.)
Well, it could be that MS Windows has some trouble allocating a large piece of chunk for the window procedure. Have you tried declaring the big 2d array inside another function? You should not be clogging the window procedure with all functionality anyway. You should have a succint switch() statement that calls functions that return the return value for the window procedure.
And to clarify: I don't know if this is something specific of the window procedure, meaning I don't have a straight answer. This is why I ask you to test placement of the array in another function (not the window procedure) to see if this simple change makes the difference or not.
nothing personal, not your fault at all. but windows is the biggest computer platform in recorded history.
god knows how many millions of people are programming for windows.
doesn't it seem reasonable that, since i am emulating my instructors (petzold and whatever other web resources i could scrape together for my pathetic gleanings of misinformation) *someone* would say...
...oh, by the way, w'ere declaring all our variables in winproc, but you're going to be screwed if you declare anythnig larger than ___
microsoft is like the largest ass company in the history of ass. couldn't someone write a decent book on learning to program for windows?
why do i have to waste an afternoon suffering in ignorance because i tried to do what petzold showed me to do?
AAAAAAAAAAAARGRRGRHRRGHRHRGRHRH
*blushes*
did they think.. oh.. noooo one is ever going to declare an array with more than 100 pieces of information in WinProc...
this is sick, evil, malicious and sadistic torture. every member of microsoft should be guillotined one by one until they can publish a decent version of petzold's "programming windows". one that doesn't make you feel like you are being pummelled in the gonads by some sort of supernova pulsar thingy.