Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
quiggy
Aug 7, 2010

[in Russian] Oof.


hello i would like to file an official grievance that a new thread was created in october that is explicitly non-spooky

Adbot
ADBOT LOVES YOU

quiggy
Aug 7, 2010

[in Russian] Oof.



i also use this op (although lol @ the www ligature)

quiggy
Aug 7, 2010

[in Russian] Oof.


Bloody posted:

if theres one thing i want in a font its to make it even harder to distinguish (if x == 0) from (if x = 0)

the ligature for == is significantly longer than the = character is; i've never once had a problem with this

quiggy
Aug 7, 2010

[in Russian] Oof.


CRIP EATIN BREAD posted:

with that said, the -> ligature is nice when working with lambdas

it's super nice in c++, as is the 0x ligature when doing stuff in hex

quiggy
Aug 7, 2010

[in Russian] Oof.


cinci zoo sniper posted:

god i loving hate json

it's really bad, op

quiggy
Aug 7, 2010

[in Russian] Oof.


it's good to me, and cool, that c++ will happily compare the value of a pointer to '\0' without so much as a warning

:negative:

quiggy
Aug 7, 2010

[in Russian] Oof.




ha ha whoops

quiggy
Aug 7, 2010

[in Russian] Oof.


Sapozhnik posted:

some wunderkind on the c++ committee thought that "ptr == 0" looked more aesthetically pleasing than "ptr == NULL"

then everybody else belatedly realized that this person is a loving moron so now there's a built in type called nullptr_t or something

except that the == 0 thing still works and of course '\0' is equivalent to 0

c++ is such a trash fire

i get that it's valid c but it's loving obnoxious that g++ won't even throw a warning for that one. i had a construct like this:

code:
for (const char* cp = str; *cp != '\0'; ++cp) { }
which is a perfectly valid way of iterating through a c-string right up until you gently caress up and forget to dereference cp in the ending conditional and the whole thing blows up

quiggy
Aug 7, 2010

[in Russian] Oof.


LordSaturn posted:

ah, my old nemesis

code:
void shutdownCallback( bool* processKillMe )
{
   // please don't, I need to do some hardware stuff
   startDoingHardwareStuff();
   processKillMe = FALSE;
}

:rip:

quiggy
Aug 7, 2010

[in Russian] Oof.


VikingofRock posted:

My g++ (7.2.0) will actually throw a hard error there:

C++ code:
#include <iostream>

int main() {
    int * p = 0;
    std::cout << (p == '\0') << std::endl;
}
pre:
$ g++ test.cpp -o test
test.cpp: In function 'int main()':
test.cpp:5:24: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
     std::cout << (p == '\0') << std::endl;

well mine doesn't, so there :colbert:

quiggy
Aug 7, 2010

[in Russian] Oof.


VikingofRock posted:

update your software OP

More seriously, does -Wconversion catch that on your g++? I would imagine it should, but I could see '\0' implicitly being given a pointer type to begin with and thus not being "converted".

ah, here we go

code:
$ g++ -std=c++03 test.cpp
$ g++ -std=c++11 test.cpp
test.cpp:5:21: error: comparison between pointer and integer ('int *' and 'int')
    std::cout << (p == '\0') << std::endl;
                  ~ ^  ~~~~
1 error generated.
my c++03 hellworld strikes again

quiggy
Aug 7, 2010

[in Russian] Oof.


Zlodo posted:

just use std::string

string str;
for( auto c : str ) {}

i work in a c++03 hellworld, we don't have your fancy for-each loops (or auto, for that matter)

fritz posted:

why would you not do:

code:
const size_t slen = strlen(str);
for(int i=0; i <slen; i++) { }

i could do this in theory, but i need this to be as fast and lightweight as possible so i don't want to double-iterate the string if possible. also just as personal preference i usually try to avoid the default c-string manipulation methods because they're all full of demons and poo poo that i don't understand that will explode if i'm not careful

quiggy
Aug 7, 2010

[in Russian] Oof.


Zlodo posted:

then
for( string::const_iterator it = str.begin(); it != str.end(); ++it ) {}

it's a c-string embedded in a serialized buffer that i'm parsing byte-by-byte

quiggy
Aug 7, 2010

[in Russian] Oof.


fritz posted:

how big are your strings / how tight is your time constraint that you don't want to do the second pass

this is a core piece of our most fundamental software package that needs to be able to process huge amounts of laser data in real-time. they're not big strings, admittedly (usually, anyway). also it's working fine now so w/e

quiggy
Aug 7, 2010

[in Russian] Oof.


'strip on panic' was my nickname in college

quiggy
Aug 7, 2010

[in Russian] Oof.


HoboMan posted:

JavaScript code:
> process.env.NODE_ENV
prod

> process.env.NODE_ENV === "prod"
false
???

i know basically no javascript but my assumption here would be that process.env.NODE_ENV is not a string "prod" but the literal value prod, maybe stored as an enum or something

quiggy
Aug 7, 2010

[in Russian] Oof.


HoboMan posted:

i figured it out, there is a trailing whitespace

more justification for my personal policy that if my boss ever asks me to write javascript i will shoot myself instead

quiggy
Aug 7, 2010

[in Russian] Oof.


Doom Mathematic posted:

Yeah, sensible programming languages trim whitespace from both ends of the string before performing comparisons...?

a sensible programming language would've made it much easier to realize what was happening

quiggy
Aug 7, 2010

[in Russian] Oof.



hey guys befunge was not a serious idea for a good language

quiggy
Aug 7, 2010

[in Russian] Oof.


PierreTheMime posted:

hey yospos, incredibly terrible programmer checking in

the engine i primarily write for has discontinued support for a java-compatible web service and has jumped to c#

which ide would you recommend for flinging simple poo poo at a screen

the answer is always vim, comrade

quiggy
Aug 7, 2010

[in Russian] Oof.


vim owns, y'all should use vim, a cool editor for people who gently caress

quiggy
Aug 7, 2010

[in Russian] Oof.


JewKiller 3000 posted:

vim is actually good if you are keyboard and text oriented, which many programmers are. sure there are fancy IDEs and i definitely use those too, sometimes that's what you need to get the job done, but vim-style modal editing really is very fluid once you get over the learning curve, and for some people that's worth it

vim is extremely fast to use once you're over that learning curve, and you're always learning cool new things. also if you're willing to put in the effort to set up plugins (which i get can be a dealbreaker) you can even get nice features like autocomplete and source tree browsing and git integration and such

vim unironically owns

quiggy
Aug 7, 2010

[in Russian] Oof.


cinci zoo sniper posted:

*palms sweating* :wq or :x? or maybe :q?

folks like to joke about this but i have no idea what visual studio thinks the difference is between Build/Rebuild/Build All/Rebuild All

Adbot
ADBOT LOVES YOU

quiggy
Aug 7, 2010

[in Russian] Oof.


JawnV6 posted:

im going to use twice as many vims

multiple splits each, too

got seven splits open across three instances of vim on two monitors right now :c00l:

  • Locked thread