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
Jerry Bindle
May 16, 2003
the comma operator has legit uses, like in "Practical UML Statecharts in C/C++" (pg 638) by Miro Samek, its used in a transition macro to perform an assignment and return a code

code:
#define Q_TRAN(target_) (((QFsm *) me)-> state = (QStateHandler) (target_), Q_RET_TRAN)

Adbot
ADBOT LOVES YOU

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

Symbolic Butt posted:

anyway serious question: what's the deal with the comma operator in C?

I mean what the gently caress

it's an infix form of PROGN, obviously

bucketmouse
Aug 16, 2004

we con-trol the ho-ri-zon-tal
we con-trol the verrr-ti-cal
the comma operator is for when you want to save 5 seconds and remove a bunch of readability/maintainability, and/or ioccc

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

Shinku ABOOKEN posted:

why does OpenCV has its own String implementation???

is this standard practice for c++ projects?

part of doing a project in c++ is assuming you can do everything more efficiently than whatever libraries or frameworks you could have used, and then extending that assumption to the c++ stdlib too

also it's possible OpenCV dates from an era before std::string was supported by all the compilers it would likely be used with, though Wikipedia says 1999-2000 and that's definitely beyond when I'd expect such bullshit. unless it had to work with VC++ 4 or GCC 2.7 or something equally terrible.

I bet it had to work with VC++ 4 or GCC 2.7 or something.

b0lt
Apr 29, 2005

eschaton posted:

part of doing a project in c++ is assuming you can do everything more efficiently than whatever libraries or frameworks you could have used, and then extending that assumption to the c++ stdlib too

also it's possible OpenCV dates from an era before std::string was supported by all the compilers it would likely be used with, though Wikipedia says 1999-2000 and that's definitely beyond when I'd expect such bullshit. unless it had to work with VC++ 4 or GCC 2.7 or something equally terrible.

I bet it had to work with VC++ 4 or GCC 2.7 or something.

the specification for std::string allows optimizations which may or may not be implemented by the implementation of std::string you're using. (libstdc++ (the one that comes with gcc) does copy on write strings (until c++11 banned it), for example, which i don't think anyone else does). if you know your program is going to be using a bunch of short strings, it might be better to use a hand rolled implementation that has a guarantee of the short string optimization; if you know you have giant read only strings, cow is better

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

rjmccall posted:

terms and notations in algebra are universal and well-established as long as you carefully only read one textbook. good luck finding a wikipedia page about an algebraic structure that doesn't have a paragraph talking about how different authors use the term for slightly different things

i mean, you're right, + is usually commutative, but appealing to the notational consistency of algebraists of all people is still pretty funny

this is why I'm being precious about it, because it's one of the few conventions that are universally consistent in a world of inconsistent poo poo. dudes can't be bothered to check nlab or something

triple sulk
Sep 17, 2014



rust is now in 1.0 beta and i still can't be arsed to care

tef
May 30, 2004

-> some l-system crap ->

triple sulk posted:

rust is now in 1.0 beta and i still can't be arsed to care

rust's target audience is programmers who want to write safe code

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

triple sulk posted:

rust is now in 1.0 beta and i still can't be arsed to care

i downloaded it and im trying it out

pseudorandom name
May 6, 2007

Shinku ABOOKEN posted:

why does OpenCV has its own String implementation???

is this standard practice for c++ projects?

yes, to the point that std::string_view was introduced specifically because nobody wants std::string semantics and everybody implements their own string type

FamDav
Mar 29, 2008

tef posted:

rust's target audience is programmers who want to write safe code

shots fired

Stringent
Dec 22, 2004


image text goes here
the safest code is the code that never gets written

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

rust seems pretty fun so far. i've never learned c or c++ or anything with manual memory management beyond making a few leds blink on an arduino

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

i like the immutability by default thing

Deacon of Delicious
Aug 20, 2007

I bet the twist ending is Dracula's dick-babies

Stringent posted:

the safest code is the code that never gets written

I'm not slacking, i'm just really really security conscious

fritz
Jul 26, 2003

Symbolic Butt posted:

this is why I'm being precious about it, because it's one of the few conventions that are universally consistent in a world of inconsistent poo poo. dudes can't be bothered to check nlab or something

some languages do "." for string concat and i guess that sort of looks like a \cdot but then you'd have all sorts of people getting all fussy about how its too confusing because it looks like the member selection operator

Forums Terrorist
Dec 8, 2011

StringBuilder concat = new StringBuilder();
String foo = "dick";
String bar = "butt";

System.out.println(concat.Concatenate(foo, bar));

Soricidus
Oct 21, 2010
freedom-hating statist shill

Symbolic Butt posted:

this is why I'm being precious about it, because it's one of the few conventions that are universally consistent in a world of inconsistent poo poo. dudes can't be bothered to check nlab or something

"why are programming language designers ignoring this convention that has developed in a non-programming-related field?"

next up itt, linguists complain about the abuse of the word "object" for the subject of a sentence, and then i think we have hp hovercraft scheduled for another slot later this week on the subject of "software engineering"

oh no blimp issue
Feb 23, 2011

Forums Terrorist posted:

StringBuilder concat = new StringBuilder();
String foo = "dick";
String bar = "butt";

System.out.println(concat.Concatenate(foo, bar));

much better

Shaggar
Apr 26, 2006

fritz posted:

some languages do "." for string concat and i guess that sort of looks like a \cdot but then you'd have all sorts of people getting all fussy about how its too confusing because it looks like the member selection operator

strings have members so that wont work

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

Soricidus posted:

"why are programming language designers ignoring this convention that has developed in a non-programming-related field?"

next up itt, linguists complain about the abuse of the word "object" for the subject of a sentence, and then i think we have hp hovercraft scheduled for another slot later this week on the subject of "software engineering"

linguists have the right to express their feelings too even if they're actually sounding like asshats like I am because yospos birch

CPColin
Sep 9, 2003

Big ol' smile.
*does a search in Eclipse*
*minimizes and restores the window, turning the whole thing gray while it hangs*
*goes home early*

FamDav
Mar 29, 2008
eclipse seems really great if you have a 32gb of ram and an ssd.

Soricidus
Oct 21, 2010
freedom-hating statist shill

FamDav posted:

eclipse seems really great if you have a 32gb of ram and an ssd.

ttgacs

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

FamDav posted:

eclipse seems really great if you have a 32gb of ram and an ssd.

nope

Valeyard
Mar 30, 2012


Grimey Drawer
eclipse is good

leftist heap
Feb 28, 2013

Fun Shoe
eclipse is fine but definitely needs some janitoring.

fritz
Jul 26, 2003


tttaam

DimpledChad
May 14, 2002
Rigging elections since '87.

Valeyard posted:

intellij is good

Shaggar
Apr 26, 2006
intellij is trash

Bloody
Mar 3, 2013

java's greatest weakness is the lack of a usable ide.

Valeyard
Mar 30, 2012


Grimey Drawer

the problem with intellij is that everyone else will be using eclipse, and then you run into all these problems anda re like "haha guess nobody can help since everyone else is using eclipse and NOT intellij :grin:"

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Shaggar posted:

intellij is trash

Nah it's much better than eclipse, I tried it out Eclipse for a month and had way too many of those gray screen freezes. If you're build is IDE agnostic then I don't know what to tell you :shrug:

ryde
Sep 9, 2011

God I love young girls
Just moved from Eclipse to IntelliJ. Much better performance all-around.

Shaggar
Apr 26, 2006
intellij was slow and the layout was crap and the plugins sucked compared to eclipse.

ryde
Sep 9, 2011

God I love young girls
Not sure what I can say to that Shaggar. Its definitely more performant than eclipse and very needs-suiting.

brap
Aug 23, 2004

Grimey Drawer

Forums Terrorist posted:

StringBuilder concat = new StringBuilder();
String foo = "dick";
String bar = "butt";

System.out.println(concat.Concatenate(foo, bar));

someone put this man out of his misery
also dont use a loving stringbuilder unless you're concatenating dozens or hundreds of strings
the compiler is not stupid and it will generally turn "foo" + "bar" + "baz" into some strcpy call more efficient than instantiating a stringbuilder, etc.

gonadic io
Feb 16, 2011

>>=

fleshweasel posted:

also dont use a loving stringbuilder unless you're concatenating dozens or hundreds of strings AT RUN TIME

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

fleshweasel posted:

someone put this man out of his misery
also dont use a loving stringbuilder unless you're concatenating dozens or hundreds of strings
the compiler is not stupid and it will generally turn "foo" + "bar" + "baz" into some strcpy call more efficient than instantiating a stringbuilder, etc.

huh I always thought javac was actually super dumb and very literal with my dumb code (at least compared with gcc)

Adbot
ADBOT LOVES YOU

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Symbolic Butt posted:

huh I always thought javac was actually super dumb and very literal with my dumb code (at least compared with gcc)

javac is pretty literal (:rimshot:) but the VM and JIT do much more advanced optimizations. for "foo" + bar + "baz" I expect that it allocates a String with length of bar.length + 6 and copies right into that new String's buffer, as an example.

  • Locked thread