Search found 18 matches

by optLog
Sun Dec 19, 2010 11:25 am
Forum: Programming Discussion
Topic: [SOLVED]noob questions about dynamic memory allocation
Replies: 3
Views: 579

Re: [SOLVED]noob questions about dynamic memory allocation

I made a memory leaking application to see what would happen if I dynamically allocated an array with zero elements in it. I had it so that it would create the zero length array a thousand times. Every time I did this the application leaked about sixteen KB of memory. I then modified the program to ...
by optLog
Fri Dec 17, 2010 9:57 pm
Forum: Programming Discussion
Topic: [SOLVED]noob questions about dynamic memory allocation
Replies: 3
Views: 579

[SOLVED]noob questions about dynamic memory allocation

If you allocate a block of memory, such as an array of five integers. How does the system know how much memory to free up when you call delete[]? And if you did something like this int *intArray = new int[0]; delete[] intArray; would "new int[0]" actually reserve anything (like even a memo...
by optLog
Mon Nov 29, 2010 2:07 am
Forum: Programming Discussion
Topic: Can i get your opinion? [TL;DR post].
Replies: 15
Views: 3311

Re: Can i get your opinion? [TL;DR post].

As someone who's currently studying the win32 api, I'd just like to mention this. A common theme I've seen in a few apis I've looked at is to use typedef to make the api easier to understand. For example, the GetMessage function returns BOOL. BOOL is really just a typedef of int. That way in additio...
by optLog
Fri Nov 19, 2010 7:02 pm
Forum: Programming Discussion
Topic: Anyone have any ideas for a console application
Replies: 13
Views: 2426

Re: Anyone have any ideas for a console application

One application that wouldn't require a gui but would still be useful would be a simple image format converter. you could have it so that the app takes a 24 bit bitmap (or any other image formats you know how to work with) and outputs a 32 bit image. This is useful for people who need an alpha chann...
by optLog
Wed Nov 17, 2010 2:11 pm
Forum: Programming Discussion
Topic: anyone know of any good win32 references?
Replies: 3
Views: 867

Re: anyone know of any good win32 references?

wearymemory I can't thank you enough.
by optLog
Wed Nov 17, 2010 12:06 am
Forum: Programming Discussion
Topic: anyone know of any good win32 references?
Replies: 3
Views: 867

anyone know of any good win32 references?

I've spent the last few weeks trying to study win32 programming and the hardest part has been finding any useful reference material. Right now I mainly want to focus on UI objects like buttons, text fields, etc. I can usually find the correct window classes for these objects but I'm having a lot of ...
by optLog
Tue Nov 02, 2010 3:44 pm
Forum: Programming Discussion
Topic: windows GetMessage function
Replies: 0
Views: 1724

windows GetMessage function

I just started learning about the windows message loop and how to use the functions GetMessage and PeekMessage. While I was making a test application using GetMessage for the message loop I had trouble getting the program to close. When I use the following message loop / Window Procedure, GetMessage...
by optLog
Thu Oct 21, 2010 9:58 pm
Forum: Programming Discussion
Topic: getting texture information from openGL
Replies: 9
Views: 979

Re: getting texture information from openGL

well... it would probably actually be faster to store that data locally, rather than having to call an OpenGL function, which would then ask the GPU for the data, and then wait for the GPU to send it back. If you want, here's a semi-general template for a Texture class: class Texture { unsigned id;...
by optLog
Thu Oct 21, 2010 9:31 pm
Forum: Programming Discussion
Topic: getting texture information from openGL
Replies: 9
Views: 979

Re: getting texture information from openGL

I don't believe there is one; texture coordinates are provided in a [0,1] range. However, if you really want the original width and height, you can store it before you call glTexImage2D (you need the width and height to call it anyway), and then use it later. I was really hoping that I wouldn't hav...
by optLog
Thu Oct 21, 2010 6:43 pm
Forum: Programming Discussion
Topic: getting texture information from openGL
Replies: 9
Views: 979

getting texture information from openGL

Is there any function(s) in openGL that would allow you to the the width and height of a texture that was sent to it?
by optLog
Fri Oct 08, 2010 1:04 am
Forum: Programming Discussion
Topic: how literals are stored in memory
Replies: 19
Views: 2934

Re: how literals are stored in memory

I'm sorry everyone I guess I've been asking the wrong question. what I'm trying to find out is how literals are stored in memory. IIRC they're usually stored on the stack. Sometimes the compiler may optimize it differently, but that is (I think) the general case. There is no need to worry about mem...
by optLog
Thu Oct 07, 2010 11:00 pm
Forum: Programming Discussion
Topic: how literals are stored in memory
Replies: 19
Views: 2934

Re: question about passing string literals to functions

I'm sorry everyone I guess I've been asking the wrong question. what I'm trying to find out is how literals are stored in memory. IIRC they're usually stored on the stack. Sometimes the compiler may optimize it differently, but that is (I think) the general case. There is no need to worry about mem...
by optLog
Thu Oct 07, 2010 10:42 pm
Forum: Programming Discussion
Topic: how literals are stored in memory
Replies: 19
Views: 2934

Re: question about passing string literals to functions

I'm sorry everyone I guess I've been asking the wrong question. what I'm trying to find out is how literals are stored in memory.
by optLog
Wed Oct 06, 2010 11:46 pm
Forum: Programming Discussion
Topic: how literals are stored in memory
Replies: 19
Views: 2934

Re: question about passing string literals to functions

let me rephrase my first question a little bit. void someFunction(char* string); int main() { someFunction("this is a string"); return 0; } how is the string literal "this is a string" handled in memory? Is it allocated as part of the main function or is memory dynamically alloca...