« first day (403 days earlier)      last day (4558 days later) » 

11:00 PM
i cant crack this one: i made a vector of objects, then each time i press space, i add another object to it, then i check if the objects that fly(those are bullets) go out of the screen bounds, and .erase these objects, than i go through all objects and draw them and move them, but i get a an error saying that vector subscript is out of range, what might be the problem?
 
your not doing raii
 
How do you erase the objects?
Do you know that some vector iterators get invalidated if you erase one?
 
so i pass the vector by ref, and for all the objects i draw them (pass in the size of the vector) and move them
ill just paste the code maybe
numberofbullets = pociski.size();

for(int x=0;x<numberofbullets;x++)
{
if(pociski[x].posY>height)
pociski.erase(pociski.begin()+x);
}
numberofbullets = pociski.size();//zapisuje ilosc pociskow
rysujpociski(numberofbullets,laser,screen,pociski,delta);
and that function is :
for(int x=0;x<liczbapociskow;x++)
{
DrawSprite(screen,sprite,pociski[x].posX, height - pociski[x].posY);
pociski[x].posY += 250*delta;
 
Right after you erase an element, what will the size of the vector become?
 
one smaller
but i check it again just in case
 
11:06 PM
And does your loop consider that?
 
how should i make it so it will consider?
alright dealt with it
thanks :)
ok, one more question
i have a for loop with x
and x<smaller than something
can i change the condition in my loop?
setting something to another value?
 
Er, sure you can, it's your loop.
 
thanks :D
 
What C++ compilers do you all use?
 
I use GCC.
 
11:15 PM
I have used Dev-C++, but only for C.
 
Hmm, Dev-C++ is bad.
 
Why?
 
It uses GCC btw, but a very outdated one.
 
@ElectroNerd Because it has been superseded by Code::Blocks?
 
11:16 PM
Whew
That is old
Alright, time to download GCC.
Why do you have to go through all these links, mirror sites, etc. just to obtain the download link?
 
Download link of what?
 
GCC
I've never used it, forgive me.
 
Yes, you have used it.
Dev-C++ is an IDE, not a compiler.
It uses the GCC compiler.
 
OK, gotcha.
 
The alternative you should be downloading is Code::Blocks, which is also an IDE.
 
11:19 PM
What IDE do you use?
 
Oh yeah, Code::Blocks.
Or Netbeans
Would Code::Blocks include GCC and updates?
 
You can compile C++ with NetBeans?
Oh, I didn't know.
@ElectroNerd Yes, download the version that reads "MinGW".
 
ok
I'm wondering if Code::Blocks would include GCC anyway?
 
@FredOverflow $800 for a CD-ROM drive in 1989, lol
 
11:21 PM
@ElectroNerd yes, but an old version, 4.4.1
you can upgrade the g++ afterward though
 
Hey @jalf, someone removed your Dev-C++ poetry from the tag wiki!
 
Has anyone here used PICs?
I guess not
Has anyone here created C++ GUIs?
 
no, well, yes
 
In other words, you started doing it but lost interest?
I can't tell you how nice it is for people to understand me.
 
no, i meant i haven't used programmable ICs except for EEPROMs
 
11:31 PM
There is no one in my family that is technically inclined, particularly towards programming.
 
Ah for that. What sort of stuff have you done with them?
 
it's long ago, like 1984 or thereabouts. i did software for a single-board computer that received NC data serially and emulated a paper reader to control the NC machine
it was a college project
so we developed on PC, and burned the EPROMs directly on the target computer.
 
Cool
 
in PL/M-86 and x86 assembly
 
11:34 PM
Ouch, you're probably thankful for C now?
Assembly is still fun though.
 
i think what's changed the most is the size of harddisks
a disk then it was huge, and round
at least for the VAX and PDPs
oh yes and one thing more, that nobody uses pip commands any more
 
I'm thinking of entering the Google Science Fair
 
Peripheral Interchange Program (PIP) was a utility to transfer files on and between devices on Digital Equipment Corporation's computers. It was first implemented on the PDP-6 architecture by Harrison "Dit" Morse early in the 1960s. It was subsequently implemented for DEC's operating systems for PDP-10 and PDP-11 architectures. History It is said that during development it was named ATLATL, which is an acronym for "Anything, Lord to Anything, Lord." This humorously described both its purpose as a device-independent file copying tool and the difficulties at the time of safely copying fi...
@ElectroNerd sounds great
 
11:44 PM
What's the best way to make iterators that depend on the container they're iterating?
 
As in a fractal?
 
Don't they all?
 
@RMartinhoFernandes What do you mean?
 
Don't all iterators depend on the container they're iterating?
 
Not really. I'm talking about iterators whose increment is dependent on the ordering of the container
Such as a queue implemented as a circular buffer
 
11:48 PM
Pubby, what is the end application?
 
Sorry if I'm being dumb, but I don't see how those are different from other iterators.
They depend the queue, just like a vector iterator depends on the vector.
 
When you iterate, you iterate.
 
Isn't vector iterator just a pointer?
 
pop_back() shouldn't invalidate the iterator, but popping from a queue would if the iterator didn't know the container's state
 
11:50 PM
Ah, ok, I see.
 
Any ideas on how to do so? STD seems to take the path of no iterators at all.
 
pop_back would only invalidate one iterator, no?
 
It would if the iterator was the last one
 
Anyway, you can keep a pointer to the container in the iterator.
 
Doesn't that lead to trouble?
 
11:56 PM
Why?
 
guyyys
 
I dunno. Copies would be troublesome
 
Copies would just copy the pointer.
 
does anyone have a real good professional ebook on epoll?
 
There's no ownership involved.
 
11:57 PM
But it would require code in each function
:S
 
Or you could have the end iterator be a special value.
That way it always stays valid.
 
You mean like nul? That could work.
 
Though that could bring complications if you plan on making the iterators bidirectional.
 

« first day (403 days earlier)      last day (4558 days later) »