• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

GROAN

Alphathree33

Platinum Member
I had a hard-coded value (19) in one of my functions back when it only did one thing.

The value was an index offset in a string, and at the beginning, the string was always the same.

Well I changed the function to take the string as an argument, and for three weeks I've been using it with the hard-coded index and variable strings without issue.

This is because, as it turns out, all of the strings I was feeding it were by chance the same length. Until today. Which led me on an hour-long bug hunt followed by a 'DOH!' when I saw the 19.

String.length baby, String.length...
 
Originally posted by: Rainsford
Bah, strings are for nancy boys. Character arrays are where it's at 😛

Or whatever we're talking about...

I totally agree. If char[] ran for president, I would vote for his burnt ass.
 
Originally posted by: Brian23
Originally posted by: Rainsford
Bah, strings are for nancy boys. Character arrays are where it's at 😛

Or whatever we're talking about...

I totally agree. If char[] ran for president, I would vote for his burnt ass.

If char[] ran for present as a Republican, he would get frustrated that he couldn't dynamically resize the federal budget.
 
Originally posted by: Alphathree33
Originally posted by: Brian23
Originally posted by: Rainsford
Bah, strings are for nancy boys. Character arrays are where it's at 😛

Or whatever we're talking about...

I totally agree. If char[] ran for president, I would vote for his burnt ass.

If char[] ran for present as a Republican, he would get frustrated that he couldn't dynamically resize the federal budget.


ah but there's always char star! See example:

char Republican[100];
char *ptr;
ptr = new char [ strlen(Republican) + aditional_chars ];
for (counter = 0; counter < strlen(Republican) + aditional_chars; counter++)
{ // <- note that the curly brace is on a new line
if (counter < strlen(Republican))
*ptr[counter] = Republican[counter];
else
*ptr[counter] = //insert dynamic new char here
}

Edit for closing curly brace 😱
 
Originally posted by: Brian23
Originally posted by: Alphathree33
Originally posted by: Brian23
Originally posted by: Rainsford
Bah, strings are for nancy boys. Character arrays are where it's at 😛

Or whatever we're talking about...

I totally agree. If char[] ran for president, I would vote for his burnt ass.

If char[] ran for present as a Republican, he would get frustrated that he couldn't dynamically resize the federal budget.


ah but there's always char star! See example:

char Republican[100];
char *ptr;
ptr = new char [ strlen(Republican) + aditional_chars ];
for (counter = 0; counter < strlen(Republican) + aditional_chars; counter++)
{ // <- note that the curly brace is on a new line
if (counter < strlen(Republican))
*ptr[counter] = Republican[counter];
else
*ptr[counter] = //insert dynamic new char here
}

Edit for closing curly brace 😱

Pointers are so 90s.
 
Originally posted by: Alphathree33
Originally posted by: Brian23
Originally posted by: Alphathree33
Originally posted by: Brian23
Originally posted by: Rainsford
Bah, strings are for nancy boys. Character arrays are where it's at 😛

Or whatever we're talking about...

I totally agree. If char[] ran for president, I would vote for his burnt ass.

If char[] ran for present as a Republican, he would get frustrated that he couldn't dynamically resize the federal budget.


ah but there's always char star! See example:

char Republican[100];
char *ptr;
ptr = new char [ strlen(Republican) + aditional_chars ];
for (counter = 0; counter < strlen(Republican) + aditional_chars; counter++)
{ // <- note that the curly brace is on a new line
if (counter < strlen(Republican))
*ptr[counter] = Republican[counter];
else
*ptr[counter] = //insert dynamic new char here
}

Edit for closing curly brace 😱

Pointers are so 90s.

qft
 
Back
Top