• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.

Programming |OT| C is better than C++! No, C++ is better than C

Ahhh okay. Duh.

So when reading input from terminal on a string of n-size, you have to end with a \0 otherwise it's just going to have a bunch of junk, right?
 

wolfmat

Confirmed Asshole
Yes, that's what you usually do, end a string with \0 so that you definitely know where it stops.
The array size does not suffice because the string could be shorter, yet not end with \0.
Remembering the string length does suffice if the string does not change, but is more cumbersome than terminating \0, and the latter is tradition anyway, and more trivial to handle.

Or you use a utility library that solves strings. That becomes more important with user strings.

And always remember to initialize your freshly claimed memory. You don't know what's in there otherwise. Weird bugs in programs come from that very common mistake of not initializing memory, and then forgetting it's not initialized, and then later assuming it's well-formed in some if clause or whatever.
 

Tantalus

Neo Member
Hey guys, quick C++ question. If this a valid way to free memory which has been "newed" in a Vector? "states" is the name of the vector in question. I ask because I am getting errors about heap corruption, and this is the only place in my program right now that uses dynamic allocation, and I'm not super experienced with it:

Code:
for(int i=0, j=states.size(); i<j; ++i)
{
	delete states[i];
	states.pop_back();
}

This seemed like the way to do it, but I might be way off. It's being called in the class destructor, if that makes a difference at all. Thanks!
 
Hey guys, quick C++ question. If this a valid way to free memory which has been "newed" in a Vector? "states" is the name of the vector in question. I ask because I am getting errors about heap corruption, and this is the only place in my program right now that uses dynamic allocation, and I'm not super experienced with it:

Code:
for(int i=0, j=states.size(); i<j; ++i)
{
	delete states[i];
	states.pop_back();
}

This seemed like the way to do it, but I might be way off. It's being called in the class destructor, if that makes a difference at all. Thanks!

You're trying to delete the element twice. pop_back calls the elements destructor.

Also, pop_back removes the last element... Take out the pop_back and call states.clear() after the loop.
 

Tantalus

Neo Member
You're trying to delete the element twice. pop_back calls the elements destructor.

Also, pop_back removes the last element... Take out the pop_back and call states.clear() after the loop.

Ah, I see. My reasoning was that pop_back would destroy the pointer to the object, whereas delete would get rid of whatever it was pointing to. But I guess popping back didn't make any sense at all now that I think about it, lol. I should be deleting inside the loop then calling clear() outside?

I just tried that, and still got the same error.

HEAP: Free Heap block 164a0c0 modified at 164a2c0 after it was freed

Sorry if I missed something; this kind of memory management isn't something I'm used to with other languages haha
 

mike23

Member
It looks like you're deleting start to end in the loop and popping end to start.

Say you have a vector of size 10

First loop looks like it

deletes element 0
and pops element 9

and since you're popping them off, you're decreasing the size of the vector by one each iteration. So by the end, you'd be trying to delete element 9 in a vector of size 1.
 

Tantalus

Neo Member
Yeah, that was a silly mistake on my part, I changed that but it seems to have made no difference. Here's my code now:

Code:
Game::~Game()
{
	// Free up state memory
	for(int i=0, j=states.size(); i<j; ++i)
	{
		delete states[i];
	}

	states.clear();
}

But I'm still getting the same error. This is definitely the only place in my code which uses dynamic allocation. The vector itself holds a couple of different objects which are all inheriting from the State base class, so I think pointers need to be used here to allow for polymorphism?
 

Roquentin

Member
Yeah, that was a silly mistake on my part, I changed that but it seems to have made no difference. Here's my code now:

*snip*

But I'm still getting the same error. This is definitely the only place in my code which uses dynamic allocation. The vector itself holds a couple of different objects which are all inheriting from the State base class, so I think pointers need to be used here to allow for polymorphism?
Do you store State* in this vector?
 
Not really programming-gaf but similar question.

Are there any good free tools out there for slicing up Photoshop files? Photoshop's slice tool is pretty awful. My main gripe with everything I've tried so far is they seem to be geared towards table layouts instead of modern CSS layouts.

Ideally I'd be able to designate boxes that would represent individual pictures that need slicing, and then configure, on a box-by-box basis, which layers to turn on and off when slicing. I would also ideally be able to save the slice layout independent of the PSD itself (so that if our designer modifies their photoshop file, I could just load up the existing slices and modify as needed rather than restarting the slice from scratch).

GIMP seems to do closest what I want with it's Guillotine tool, but it's just too aggressive- both generating too many slices that I don't need, and slicing up slices I do need too much.
 

Slavik81

Member
You're trying to delete the element twice. pop_back calls the elements destructor.

If he's deleting the element, it's obviously a pointer. pop_back will not delete the object being pointed to if the value being stored in the vector is a pointer.

The code was wrong, but not for the reason you stated. He was removing the last element upon deleting the first. After the halfway mark, he'd run off the end of the vector.


Yeah, that was a silly mistake on my part, I changed that but it seems to have made no difference. Here's my code now:

Code:
Game::~Game()
{
	// Free up state memory
	for(int i=0, j=states.size(); i<j; ++i)
	{
		delete states[i];
	}

	states.clear();
}

But I'm still getting the same error. This is definitely the only place in my code which uses dynamic allocation. The vector itself holds a couple of different objects which are all inheriting from the State base class, so I think pointers need to be used here to allow for polymorphism?
Without knowing more, this code appears to be correct. Whatever your problem is, we need more information to solve it.

Might any state be stored in the vector twice? If so, this code will delete it twice.
Also, do states have references to each other that they access in their destructor? If so, perhaps the order of destruction is important.
 
Im having trouble with something in java, I need to check if a number is divisible by either 5 or 6 but not both of them.This is for a project so I dont want you writing the code for me. I just need to know what I am doing wrong.

I think I need to use "not both"
Code:
System.out.print("Is " + giveninteger + " divisible by 5 or 6 but not both?");
		if (!((giveninteger % 5 == 0) && (giveninteger % 6 == 0)))
			System.out.println(" True");
			else
			System.out.println(" False");

I've also tried to use "not or not"
Code:
System.out.print("Is " + giveninteger + " divisible by 5 or 6 but not both?");
		if (!((giveninteger % 5 == 0) || !(giveninteger % 6 == 0)))
			System.out.println(" True");
			else
			System.out.println(" False");

Is the error obvious? what direction should I head in?
 
It should be
((!A & B) | (A & !B))

Yours was
!(A & B) ------> !A | !B

And your second one was the same
!A | !B

Where
A = divisible by 5
B = divisible by 6

You probably still simplify this but I already forgot the rules. You basically just got the wrong conditions.
 

Slavik81

Member
XOR

It's trivial to implement. If you google, you will wonder why you didn't think of it.

Answer is spoilered:
isDivisibleBy5(x) != isDivisibleBy6(x)
or
isDivisibleBy5(x) ^ isDivisibleBy6(x)
 
Yeah, that was a silly mistake on my part, I changed that but it seems to have made no difference. Here's my code now:

Code:
Game::~Game()
{
	// Free up state memory
	for(int i=0, j=states.size(); i<j; ++i)
	{
		delete states[i];
	}

	states.clear();
}

But I'm still getting the same error. This is definitely the only place in my code which uses dynamic allocation. The vector itself holds a couple of different objects which are all inheriting from the State base class, so I think pointers need to be used here to allow for polymorphism?
What's the type of states?

It's a vector, but a vector of what?

vector<SomeClass>?
vector<SomeClass*>?
 

Slavik81

Member
This does work. Could you explain why you added the '&&!(x%30==0)' to it?

It might help to rephrase it in English. "Is x is divisible by 5 or divisible by 6 but not divisible by 30?" compare that to your original statement "I need to check if a number is divisible by either 5 or 6 but not both of them."

(I don't want to give it away, but walrus could explain if he likes)
 
It might help to rephrase it in English. "Is x is divisible by 5 or divisible by 6 but not divisible by 30?" compare that to your original statement "I need to check if a number is divisible by either 5 or 6 but not both of them."

Right anything that is divisible by two numbers is divisible by their product as far as I can recall. Been a while though, haha

So if something is divisble by 5 and 6 it is also divisble by 5 * 6.
 
It might help to rephrase it in English. "Is x is divisible by 5 or divisible by 6 but not divisible by 30?" compare that to your original statement "I need to check if a number is divisible by either 5 or 6 but not both of them."

(I don't want to give it away, but walrus could explain if he likes)

Right anything that is divisible by two numbers is divisible by their product as far as I can recall. Been a while though, haha

So if something is divisble by 5 and 6 it is also divisble by 5 * 6.

Gotcha, I'm just starting out with java and programming in general. I'm still getting use to being able to understand code well. Walrus' suggestion worked and is giving me the answers that I was looking for.

Thanks for the help guys!
 
Gotcha, I'm just starting out with java and programming in general. I'm still getting use to being able to understand code well. Walrus' suggestion worked and is giving me the answers that I was looking for.

Thanks for the help guys!

There were more easily comprehensible ways to do it, the way I gave is just more efficient than most.
 

Lathentar

Looking for Pants
If he's deleting the element, it's obviously a pointer. pop_back will not delete the object being pointed to if the value being stored in the vector is a pointer.

The code was wrong, but not for the reason you stated. He was removing the last element upon deleting the first. After the halfway mark, he'd run off the end of the vector.



Without knowing more, this code appears to be correct. Whatever your problem is, we need more information to solve it.

Might any state be stored in the vector twice? If so, this code will delete it twice.
Also, do states have references to each other that they access in their destructor? If so, perhaps the order of destruction is important.

Or just use a smart pointer and be done with it.
 

hateradio

The Most Dangerous Yes Man
Gotcha, I'm just starting out with java and programming in general. I'm still getting use to being able to understand code well. Walrus' suggestion worked and is giving me the answers that I was looking for.

Thanks for the help guys!
Just a small tip, since you already have the solution.

You should consider using the identity operator (===) whenever possible. Generally, it comes to the type of comparison you need, but there are slight speed improvements, since there is no type conversion (ie, 1 == '1' is true because the ones are converted to similar types, while 1 === '1' is false).

In your case, the calculation will always return a number. Knowing that, you don't need a conversion.

I would have written it like this.

Code:
(x % 5 === 0 || x % 6 === 0) && x % 30 !== 0
 

hateradio

The Most Dangerous Yes Man
hateradio, you're talking about Javascript, but the question was about Java.

1 == '1' is false in Java.
I know it was about Java, but he also said that s/he was a beginner programmer, so it could come in handy in other languages.
 

Tantalus

Neo Member
What's the type of states?

It's a vector, but a vector of what?

vector<SomeClass>?
vector<SomeClass*>?

Yep, it's been defined as:

Code:
std::vector<State*> states;

There is usually only one state in the vector at a time. When a new state is needed, the one currently in use is deleted and popped, and the new one is pushed in; could this be causing problems? I don't have the code on hand otherwise I would show how this is done

I thought using a loop in the destructor was a good way to ensure that in the occassions when more than one state is being stored at once, they are all being destroyed correctly
 

Zoe

Member
I know it was about Java, but he also said that s/he was a beginner programmer, so it could come in handy in other languages.

AFAIK, JavaScript is the only one with that operator. You need to be specific to avoid confusion.
 
I got a Flex problem, but tip in any language (Java/C#/whatever) helps. This is a simplified version of my problem but the problem stands.

I have a list of comma separated values of things


Code:
ID ;ITEM NUMBER; DESCRIPTION;
1   ; 12345-56789  ; PIZZA;;
2   ; 2345-567891  ; HOTDOG;;
3   ; 345-5678912  ; HAMBURGER;;

What the user sees is a DataGrid like so

Code:
ITEM NUMBER | DESCRIPTION|
12345-56789  | PIZZA            |
2345-567891  | HOTDOG        |
345-5678912  | HAMBURGER  |

When user clicks Pizza for example, it dispatches an event with the according ID and the full PIZZA information pops out. That works as it should work.


But I also have a text field, where the customer can input the ITEM NUMBER. The problem is that if I enter 12345-56789, it says No such ID, but 1 pops up the right thing.

What I obviously need to do is check which ID Item Number 12345-56789 corresponds to but I haven't gotten very far. I know alternative (and most likely better ways) to do this but the code isn't mine, isn't documented so if I could just do that in one line that would help tons. In the original version it just used the ITEM NUMBER as identifier there were some dumbass overwriting problems with the .CSV's in the customers data (How can two different items have a same ITEM NUMBER anyway??? They were like :shrug: it is what it is toobad.jpg).

Current function:
private function searchID(e:Event):void
{
var itemID:String = searchInput.text;
this.dispatchEvent(new ExampleCustomEvent(TO_POPUP, ItemID));

}
 
Hey guys, I have a problem with a method using visual basic. It's a very simple problem, but I just can't get the answer to come out correctly. My answer is coming out as 1,253.34 but when I use a calculator to get the answer, it's coming out as 1,253.33. My book is saying that I need to use a math.round method, but it doesn't explain how to code the method into the program. I'll just post my code that I have so it'll be easier to see what I have.

' constant

Const decState As Decimal = 0.124
Const decCounty As Decimal = 0.096
Const decSchool As Decimal = 0.557
Const decAmbulance As Decimal = 0.1
Const decHealth As Decimal = 0.038
Const decLibrary As Decimal = 0.093
Const decSoil As Decimal = 0.02

' variables

Dim decTotal As Decimal
Dim decValue As Decimal
Dim decStatetotal As Decimal
Dim decCountytotal As Decimal
Dim decSchooltotal As Decimal
Dim decAmbtotal As Decimal
Dim decHealthtotal As Decimal
Dim decLibrarytotal As Decimal
Dim decSoiltotal As Decimal


'store Value in a variable

Decimal.TryParse(txtValue.Text, decValue)

'calculate total property

decStatetotal = decState * decValue / 100
decCountytotal = decCounty * decValue / 100
decSchooltotal = decSchool * decValue / 100
decAmbtotal = decAmbulance * decValue / 100
decHealthtotal = decHealth * decValue / 100
decLibrarytotal = decLibrary * decValue / 100
decSoiltotal = decSoil * decValue / 100
decTotal = decStatetotal + decCountytotal + decAmbtotal + decSchooltotal +
decHealthtotal + decLibrarytotal + decSoiltotal

'display

lblProperty.Text = decTotal.ToString("c2")
lblSchool.Text = decSchooltotal.ToString("n2")
lblAmbulance.Text = decAmbtotal.ToString("n2")
lblCounty.Text = decCountytotal.ToString("n2")
lblHealth.Text = decHealthtotal.ToString("n2")
lblSoil.Text = decSoiltotal.ToString("n2")
lblLibrary.Text = decLibrarytotal.ToString("n2")
lblState.Text = decStatetotal.ToString("n2")
 

wolfmat

Confirmed Asshole
Hey guys, I have a problem with a method using visual basic. It's a very simple problem, but I just can't get the answer to come out correctly. My answer is coming out as 1,253.34 but when I use a calculator to get the answer, it's coming out as 1,253.33. My book is saying that I need to use a math.round method, but it doesn't explain how to code the method into the program. I'll just post my code that I have so it'll be easier to see what I have.

After you calculate decTotal, you add a line like so to round decTotal to 2 decimals:
Code:
decTotal = Math.Round(decTotal, 2)

Edit: If you just want to round on-the-fly for display purposes while keeping the precise value in the variable, you instead round when setting the text like so:
Code:
lblProperty.Text = Math.Round(decTotal, 2).ToString("c2")
 
After you calculate decTotal, you add a line like so to round decTotal to 2 decimals:
Code:
decTotal = Math.Round(decTotal, 2)

Edit: If you just want to round on-the-fly for display purposes while keeping the precise value in the variable, you instead round when setting the text like so:
Code:
lblProperty.Text = Math.Round(decTotal, 2).ToString("c2")

Okay, so I added the line like this:

'display

lblProperty.Text = decTotal.ToString("c2")
lblSchool.Text = decSchooltotal.ToString("n2")
lblAmbulance.Text = decAmbtotal.ToString("n2")
lblCounty.Text = decCountytotal.ToString("n2")
lblHealth.Text = decHealthtotal.ToString("n2")
lblSoil.Text = decSoiltotal.ToString("n2")
lblLibrary.Text = decLibrarytotal.ToString("n2")
lblState.Text = decStatetotal.ToString("n2")

'round
decTotal = Math.Round(decTotal, 2)

I'm still getting 1,253.34 for some reason. I wonder if I have a mistake in the code somewhere.

Edit: If you just want to round on-the-fly for display purposes while keeping the precise value in the variable, you instead round when setting the text like so:
Code:
lblProperty.Text = Math.Round(decTotal, 2).ToString("c2")

Damn, still comes out to the wrong answer with this one as well.
 

wolfmat

Confirmed Asshole
Okay, so I added the line like this:



I'm still getting 1,253.34 for some reason. I wonder if I have a mistake in the code somewhere.

You added the line too late. You need to add it before 'display

The text of the field needs to be set after the rounding takes place, not before!
 
You added the line too late. You need to add it before 'display

The text of the field needs to be set after the rounding takes place, not before!

Ahh okay, got ya. I currently have the code like this. Still trying to see if I have something messed up because it's coming up with the same answer I had before.

'round
decTotal = Math.Round(decTotal, 2)

'display

lblProperty.Text = decTotal.ToString("c2")
lblSchool.Text = decSchooltotal.ToString("n2")
lblAmbulance.Text = decAmbtotal.ToString("n2")
lblCounty.Text = decCountytotal.ToString("n2")
lblHealth.Text = decHealthtotal.ToString("n2")
lblSoil.Text = decSoiltotal.ToString("n2")
lblLibrary.Text = decLibrarytotal.ToString("n2")
lblState.Text = decStatetotal.ToString("n2")
 

wolfmat

Confirmed Asshole
Ahh okay, got ya. I currently have the code like this. Still trying to see if I have something messed up because it's coming up with the same answer I had before.

Comment out the rounding for a minute by adding an apostrophe in front of the line:
' decTotal = Math.Round(decTotal, 2)

Replace
lblProperty.Text = decTotal.ToString("c2")

with
lblProperty.Text = decTotal.ToString("c4")

and check what the value is with 4 decimals to figure out how the result should actually be rounded.
 
Comment out the rounding for a minute by adding an apostrophe in front of the line:
' decTotal = Math.Round(decTotal, 2)

Replace
lblProperty.Text = decTotal.ToString("c2")

with
lblProperty.Text = decTotal.ToString("c4")

and check what the value is with 4 decimals to figure out how the result should actually be rounded.

Hmmm, coming out to 1253.3376... Guess that explains why it's not rounding down.
 

wolfmat

Confirmed Asshole
Hmmm, coming out to 1253.3376... Guess that explains why it's not rounding down.

Now go through the other format strings saying "n2" and replace them with "n4" (or "n6" or "n8" or whatever makes sense to you), calculate the values with the calculator, compare and see where you're off.

Edit: By the by, this is pretty much debugging by hand; you might want to read into how debugging works in your VisualBasic environment to make things waaay easier for you ;)
 
Now go through the other format strings saying "n2" and replace them with "n4" (or "n6" or "n8" or whatever makes sense to you), calculate the values with the calculator, compare and see where you're off.

Edit: By the by, this is pretty much debugging by hand; you might want to read into how debugging works in your VisualBasic environment to make things waaay easier for you ;)

Damn I think I finally figured it out. I'm getting the correct answer now, but it seems like I had to do a little more than what I initially thought. I just had the taxes forcefully rounded after they were figured with the corresponding formulas, then had those numbers added together in the decTotal formula. I'm not sure if this was the right way to do it, but I am getting the answer the book says I'm supposed to be getting. Here's what I did.

'calculate total property

decStatetotal = decState * decValue / 100
decCountytotal = decCounty * decValue / 100
decSchooltotal = decSchool * decValue / 100
decAmbtotal = decAmbulance * decValue / 100
decHealthtotal = decHealth * decValue / 100
decLibrarytotal = decLibrary * decValue / 100
decSoiltotal = decSoil * decValue / 100

'round

decStatetotal = Math.Round(decStatetotal, 2)
decCountytotal = Math.Round(decCountytotal, 2)
decSchooltotal = Math.Round(decSchooltotal, 2)
decAmbtotal = Math.Round(decAmbtotal, 2)
decHealthtotal = Math.Round(decHealthtotal, 2)
decLibrarytotal = Math.Round(decLibrarytotal, 2)
decSoiltotal = Math.Round(decSoiltotal, 2)

'calc total

decTotal = decStatetotal + decCountytotal + decAmbtotal + decSchooltotal +
decHealthtotal + decLibrarytotal + decSoiltotal

'display

lblProperty.Text = decTotal.ToString("C2")
lblSchool.Text = decSchooltotal.ToString("n2")
lblAmbulance.Text = decAmbtotal.ToString("n2")
lblCounty.Text = decCountytotal.ToString("n2")
lblHealth.Text = decHealthtotal.ToString("n2")
lblSoil.Text = decSoiltotal.ToString("n2")
lblLibrary.Text = decLibrarytotal.ToString("n2")
lblState.Text = decStatetotal.ToString("n2")
 
Yep, it's been defined as:

Code:
std::vector<State*> states;

There is usually only one state in the vector at a time. When a new state is needed, the one currently in use is deleted and popped, and the new one is pushed in; could this be causing problems? I don't have the code on hand otherwise I would show how this is done

I thought using a loop in the destructor was a good way to ensure that in the occassions when more than one state is being stored at once, they are all being destroyed correctly
I don't see any obvious problems with what you're describing and the code you posted above, but it might be useful to consider what's actually being stored here:

A variable of type vector<State*> is an object (instantiated class) on the stack (like x is in 'int x = 0;') that acts as a magically resizing array of State* variables. But the State* variables, such as they are, can be thought of as unsigned ints -- they're pointers to the stuff you really care about: the real object of type State (no pointer) that's living off somewhere on the heap. Your vector is just bookkeeping for the pointers, it doesn't know anything about the objects themselves.

So your destructor code should be fine, since it's just going through the pointers you have stored and cleaning up the heap memory that each one points to. If it's crashing in the destructor, that means that something went wrong previously in such a way that you're only learning about it at the end. For example, what if you added the same State* pointer into the vector twice? The second delete = kaboom!
 
Alright this is legitimately bothering me...

Code:
    double la1 = 0, la2 = 0, lo1 = 0, lo2 = 0;
    
    printf("Enter latitude 1: ");
    scanf("%lf", &la1);
    printf("Enter longitude 1: ");
    scanf("%lf", &lo1);
    printf("Enter latitude 2: ");
    scanf("%lf", &la2);
    printf("Enter longitude 2: ");
    scanf("%lf", &lo2);
    
    printf("%lf", geodistance(la1, la2, lo1, lo2));

seems fine, right? Well it's only letting me enter 1 value for each. After that it refuses. So anything 0-9 is fine, whereas 10 or greater is an issue... Any reason why? This isn't important to what I'm doing, besides being a tester, but it's still frustrating...

also I know it can be done in one line. I'm using this to test to see what's up.
 

jon bones

hot hot hanuman-on-man action
just started coding seriously - messed around with it over the years but never got serious about it til now. now i'm getting my master's in comp sci and i'm loving the learning process.

i know c++ and java reasonably well, currently i'm learning python.
 

Tantalus

Neo Member
I don't see any obvious problems with what you're describing and the code you posted above, but it might be useful to consider what's actually being stored here:

A variable of type vector<State*> is an object (instantiated class) on the stack (like x is in 'int x = 0;') that acts as a magically resizing array of State* variables. But the State* variables, such as they are, can be thought of as unsigned ints -- they're pointers to the stuff you really care about: the real object of type State (no pointer) that's living off somewhere on the heap. Your vector is just bookkeeping for the pointers, it doesn't know anything about the objects themselves.

So your destructor code should be fine, since it's just going through the pointers you have stored and cleaning up the heap memory that each one points to. If it's crashing in the destructor, that means that something went wrong previously in such a way that you're only learning about it at the end. For example, what if you added the same State* pointer into the vector twice? The second delete = kaboom!

I'm wondering if the problem could be coming from the library I'm using (SFML 2.0 RC). Here's what I wrote up for "popping" a state from the vector when it's no longer needed, I think it's also correct and this is definitely the only place where I am using heap memory.

Code:
// Pop back a state
void Game::popState()
{
	if(!states.empty())
	{
		delete states.back();
		states.pop_back();
	}
}

Thanks a whole bunch for your help though, and thanks for the explanation on my vector of pointers. I understood what was going on, but your explanation was fantastic, and I had never thought of pointers as just unsigned integers that store the address before. C++ is a really fun language, and through all it's nuances and technicalities I feel like I've become a better (stricter) programmer already

Edit: Oh, and yeah, I had never thought about the potential for adding the same pointer to the vector twice. There would never be any practical use for doing so right now, and States are controlled pretty tightly in that they get instantiated in a very specific place in the code, and deleted only when another State is instantiated or when the destructor on the class holding the vector is called, so there is a very small likelihood of that ever happening
 
AFAIK, JavaScript is the only one with that operator. You need to be specific to avoid confusion.

PHP has it too but PHP is the shittiest language known to man so you should be avoiding it anyway.

just started coding seriously - messed around with it over the years but never got serious about it til now. now i'm getting my master's in comp sci and i'm loving the learning process.

i know c++ and java reasonably well, currently i'm learning python.

Python is an excellent language to know. When you get some time to round out I'd recommend you look into a more deeply functional language as well (like Haskell or Scheme/Lisp) as well as check out the other end of the spectrum and do some assembly programming. Then you'll have covered a wide enough base of language ideologies to learn anything else very quickly.
 
Top Bottom