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
Zlodo
Nov 25, 2006

brainwrinkle posted:

first class functions are great. i love some of the language concepts in javascript (prototype inheritance is cool once you get it), but holy hell that implementation is so terrible.

please tell me there is a language as fun as javascript but actually good

try lua, it has a lot of the same concepts as javascript including first class functions but its much cleaner, and it also have coroutines which own

too bad its a bit weak as a stand alone language, people mostly embed it into other things (mostly vidya games) so in terms of available libraries and such its a bit weak

Adbot
ADBOT LOVES YOU

Zlodo
Nov 25, 2006

this, this a million times
embrace the darkness of templates, stop caring about "omg this is crazy obfuscated poo poo" and go all out implementing crazy compile time algorithms and you'll enjoy c++ a lot

also generally stop caring about whether ur a bad programmer if u want to enjoy programming

Zlodo
Nov 25, 2006

Mr SuperAwesome posted:

yeah this is the whole point of intellisense. that also f12 if you're really stuck or retarded or more likely the original author was retarded
well its in c# so everyone involved was probably retarded

Zlodo
Nov 25, 2006

Mr SuperAwesome posted:

i didn't find that but i found this instead which is good too

C/C++ [edit]
  • "Tsk, tsk," said the Hatter, "what a mess you've made."
    "It is perfectly fine," replied Alice calmly. "I will leave it for the garbage collection service to recover."
    "Don't expect any garbage collection here. Furthermore, your polymorphic variables won't ever be properly deleted, because you haven't declared your destructor to be virtual."
    "My what to be what?" said Alice, starting to get worried.
    "Declare your destructor. You must have a destructor. Everything that is constructed should be destroyed; it's only natural. Furthermore, if you are ever not quite what you seem, you should declare yourself to be virtual."
    "A rule to remember!" roared the Red Queen. "Never make a mess without cleaning it up first."
    "You can ignore her," whispered the Dormouse, picking up the tea cake Alice had just set aside, "but you shouldn't cast away const so lightly."
    Alice began to feel that this new world she found herself in was not quite the same as the cozy sitting room she had just left.
    Timothy Budd (C++ for Java Programmers)

  • I invented the term Object-Oriented, and I can tell you I did not have C++ in mind.
    Alan Kay [1]

  • What you see is all you get.
    Brian Kernighan [citation needed]

  • There are only two things wrong with C++: The initial concept and the implementation.
    Bertrand Meyer [citation needed]

  • Fifty years of programming language research, and we end up with C++?
    Richard O'Keefe [citation needed]

  • A C program is like a fast dance on a newly waxed dance floor by people carrying razors.
    Waldi Ravens [citation needed]

  • The evolution of languages: FORTRAN is a non-typed language. C is a weakly typed language. Ada is a strongly typed language. C++ is a strongly hyped language.
    Ron Sercely [citation needed]

  • Within C++, there is a much smaller and cleaner language struggling to get out.
    Bjarne Stroustrup, The Design and Evolution of C++

  • In C++ it's harder to shoot yourself in the foot, but when you do, you blow off your whole leg.
    Bjarne Stroustrup Stroustrups FAQ

  • C++: an octopus made by nailing extra legs onto a dog.
    Steve Taylor [citation needed]

  • C provides a programmer with more than enough rope to hang himself. C++ provides a firing squad, blindfold and last cigarette.
    dandelion in talk.origins (see here)

don't post shaggar's fanfics

Zlodo
Nov 25, 2006

im the vidya game written in java

Zlodo
Nov 25, 2006

Jerry SanDisky posted:

did u know you can do more than just java with eclipse?

why would anyone use eclipse for anything else than java

"let me install an ide that is bloated to hell because it has a million features for java but use it for a diff language where those features don't work" - no one ever

well i guess it can quick fix ur spelling in comments lol

Zlodo
Nov 25, 2006

MeruFM posted:

C++ hits the market that needs to be fast with the trade-off of being either super expensive or buggy. OSes for the former, games for the latter.
games aren't buggy because c++, games are buggy because bad project management, lack of formalized development methods, over compressed development schedules or a combination thereof

and when you get lucky to work at a game studio with none of those problems it owns

but given that most bugs found in games happen at a high level (things like broken transitions between states, or errors caused by level layout changes and such) and not specific to the way things are some in c++ you'd have games just as buggy if they were written in a diff language like java or c# or whatever else really

Zlodo
Nov 25, 2006

PleasingFungus posted:

code:
class CUnit ... {
    #include "header_1.h"
    #include "header_2.h"
    #include "header_3.h"
    #include "header_4.h" //each of these headers is several hundred lines long
};

this is exactly the kind of thing where people tend to go "lol c++" because #include whereas the real problem is the awful architecture with everything and the kitchen sink stuffed into some base class
and also from your article the guy reinventing a bad linked list instead of using the stl (which is something you could do in any other language too with equally bad outcome)

Zlodo
Nov 25, 2006

prefect posted:

just relax; every language is blamed for the sins of its worst users

true

Zlodo
Nov 25, 2006

SavageMessiah posted:

lol I remember seeing some ruby tdd zealot unironically talking about unit tests for unit tests

tell him that he should go all the way and make unit tests for every unit test

watch him go into an infinite recursion

Zlodo
Nov 25, 2006
you surely meant

for( auto& thing : myList )

Zlodo
Nov 25, 2006

uG posted:

surely c++ is the same as c

oh wait its std::poo poo

surely you wouldn't use c when there is literally no reason not to use c++ instead

Zlodo
Nov 25, 2006

uG posted:

yes the answer is always to use another language but the answer is never to use c++

oh
thanks for the tip

well im sure i can convince my company to make our next game in a java or p-lang, im sure it'll run just fine on consoles

Zlodo
Nov 25, 2006
a mere mortal only really needs to know about lvalues and rvalues (and you can in fact pretty much ignore the later and still write functionnal c++ code, if slightly inefficient at times bc of superfluous copies)

the other -values are basically just there to define all the subtleties of the behavior of rvalues and move semantics in the c++ standard and a mere mortal doesn't have to know all those intricacies to write c++ code

lol if u use a single-vendor language where they dont need to go into that much standardization detail

Zlodo
Nov 25, 2006

Cocoa Crispies posted:

maybe you should find a company that uses p-languages or j-languages so you don't have to work in a game sweatshop
of all the companies i worked at in and outside of the video game industry its by far the least sweat-shoppy one (and yet it is also the only one where the game were making is actually good)

Zlodo
Nov 25, 2006
threading poo poo in a way that work can be easy
threading poo poo in a way that works and that actually performs better than not using threads is harder, there's lots of performance pitfalls

Zlodo
Nov 25, 2006

Bloody posted:

this is absolutely fine. the task im handling is trivially parallelized - nothing any thread is doing has any impact whatsoever on the other threads. The individual tasks are relatively long - as much as half an hour of serial execution. this triviality scales well to hundreds of cores and terabytes of ram, which has the downside that i cant just spawn a thread for each task and wait for all of them to finish at once.

changing languages is unfortunately not an option at all for a variety of uninteresting reasons.

im using gcc 4.7 so whatever is available there is available to me

have a look at intel's tbb library: https://www.threadingbuildingblocks.org/

it provides a lot of tools to simplify writing parallel algorithms while avoiding a lot of performance hazards. for instance the amount of work that each parallel task does is tricky to get right: if you dispatch too many small tasks you're going to have too much overhead with the tasks dispatching, and its better to process a bunch of consecutive data in a given task to better use the cache etc.
thread building blocks have generic algorithms like parallel_for that takes care of this kind of gory details for you (theres some reasonable default heuristics for that which you can tune if you want).

it also provides an efficient parallel memory allocator (traditional memory allocators tend to serialize allocations between threads so memory allocation can easily become a big point of contention), lock-free containers etc.

Zlodo
Nov 25, 2006

Nomnom Cookie posted:

actually eve is running away from python as fast as they can because they want the servers to not run like poo poo

the eve client is also written mostly in python (with all the low level rendering engine etc. written in c++ master race)

it's possible to run the entire client through a decompiler and modify it
people making all those mining bots just build upon the autopilot code and make their own ingame configuration UIs etc.

basically lol eve online

----------------
This thread brought to you by a tremendous dickhead!

Zlodo
Nov 25, 2006
idk i have 2^24 memorized back from the days where gfx cards started using 24 bits per pixel and people were like 16777216 colors holy poo poo

Zlodo
Nov 25, 2006

Shaggar posted:

vs suck dick

Zlodo
Nov 25, 2006

Shaggar posted:

blargh. so gross. all of this .net

Zlodo
Nov 25, 2006
.net is like python, people use it only because it comes with a huge set of mediocre libraries

Zlodo
Nov 25, 2006

Mr SuperAwesome posted:

in terms of language features, syntax, and general ease of use of writing ur code c# is clearly the best at like everythin

u rarely gotta boilerplate anything

the only thing I remember from my previous gig at a terrible company which used .net was the amount of lovely c# boilerplate

i remember thinking "if it was c++ i could factor away all that poo poo in templates" about 10 times a day. in fact the c++ portions of the project were actually much more concise despite of the admittedly ugly profusion of const shared_ptr< butt >& everywhere

heck you can often end up with ridiculously long and verbose types like in c++ but without typedef to help with it

i once wanted to do a lower_bound search in a sorteddictionary and the only solution I found on google was "roll your own tree based container" which is p lol

thankfully theres also those amazing toolkits: winforms aka "MFC, but with .net"

and xaml aka "let's once again make developers write XML by hand because it never gets old but let's make it even more gross by adding an ad hoc sub-language inside of some of the xml strings"

but yeah other than all that i guess .net is great

Zlodo
Nov 25, 2006
shut up, angry policeman shaggar

Zlodo
Nov 25, 2006

Dessert Rose posted:

using ButtFart = System.Collections.Generic.List<KeyValuePair<Butt, Fart>>;

does it works in a class

like in c++ when we do things like

code:
template< typename T > class Butt
{
public:
  using fart_type = GenericFart< Butt< T > >;
};

Zlodo
Nov 25, 2006

FamDav posted:

Lisp has lambdas and is from 1958. C++ got them last year.

a lot of things are easy to do when you don't give a gently caress about performance

which is why things take a long time to make it into production languages

Zlodo
Nov 25, 2006

Mr SuperAwesome posted:

no overloading operators is p lol

Zlodo
Nov 25, 2006

Notorious b.s.d. posted:

type erasure was an engineering problem not a language design problem. an implementation detail.

but yeah they hosed that one up bigtime

I'm sure its a great relief when you get bitten in the rear end by it
"no worry mate just an implementation detail"

Zlodo
Nov 25, 2006

USSMICHELLEBACHMAN posted:

lol doing math with objects is dumb wtf steveE??

theres nothing wrong with having a wide enough definition of "object" that encompasses types
unless your using a j-lang where they insist that every object must be heavy and costly and have no notion of passing things by value

sometimes you manipulate mathematical objects other than scalars and theres no reason you should have to use a diff syntax when doing calculations on them

Zlodo
Nov 25, 2006

Notorious b.s.d. posted:

java is mandatory pass-by-value jackass
there is literally no way to pass by reference

idc my point is that it is actually always passed by reference from a low level point of view (as opposed as being directly pushed onto the stack or even across multiple registers like when objects are passed by value in c++) which in turns makes every class no matter how small such as a mathematical vector inefficient as hell even though there should be no reason objects cant be lightweight and still have methods or overloaded operators


so it precludes a lot of cool things because theres this language limitation where every object is heavyweight as it has to be allocated on its own on the heap

quote:

except that programming is not math
your opening quite the can of worms there mate hope that no functional programmer hear you

Zlodo
Nov 25, 2006

Notorious b.s.d. posted:

c# is the only high-level language I can think of that makes stack-allocated objects a choice, and even then they are tightly limited

what did you have in mind where stack allocation is the norm?

vectors, matrices, tuples, smart pointers, option type wrappers, tagged unions... there's lots of useful small things that are nice to be able to be passed around efficiently or embedded into other objects without being separated somewhere in memory for cache and memory allocation efficiency

Zlodo
Nov 25, 2006

Notorious b.s.d. posted:

saying "gee i'd like to have this in cache" is not the same as "gee i'd like to worry about stack allocation details in my high level language"

i don't really worry about any of that stuff on a jvm language.

its not "worrying about stack allocation details", its being able to say "pass this thing by value because i know its small" and even if at high level you dont necessarily have to care being able to pass value types around efficiently is the difference between "wee lets use option types everywhere bc its neat and almost free" and "better be careful not to overuse those because theyre pointlessly slow"

also yeah i can tell java and c# developers dont give a gently caress about performances whenever things lock up on me to crap the bed while doing garbage collection
you can tell more and more of visual studio is replaced with slow c# code with each version bc that thing is becoming comically slow

and in fact i'm not saying "you sholuld worry about cache locality" but perhaps the people who design the language / vm / libraries that you use should

Zlodo
Nov 25, 2006

PleasingFungus posted:

'why isn't Java C?'

im the false dichotomy

Zlodo
Nov 25, 2006

Nomnom Cookie posted:

Java passes references by value. Pass by reference is a different thing that Java doesn't do. Ref params in C#, iirc pascal does it too.

i was talking of the implementation of parameter passing by the compiler, not about the semantics

quote:

Also Hotspot is p fuckin sharp about heap management, much moreso than C++. Maybe you lose some cache locality but the big killer is the inherent per-object overhead in Java which is something like 16 bytes.
there are other costs with heap allocations, such as the allocation itself which is order of magnitudes costlier than allocating something on the stack (which is just an addition)


quote:

Overloading operators for math is real dumb.
when your doing a lot of operations on things like vectors or matrices or whatever (or like say, doing things like interpolating colors) overloading operators is much more concise and readable

some people happen to have to work a lot with other datatypes than just int bool and string

Zlodo
Nov 25, 2006

Brain Candy posted:

do you even profile?

profiling is useful when considering an optimization that comes at a cost of your program's readability/maintainability/flexibility/stability which is not what is being discussed here

"ok i'll do a new on that struct and pass a smart pointer to it and then i'll profile and if necessary replace it with passing it directly by value which is both much more readable and faster" - nobody ever


Brain Candy posted:

stack allocation, operator overloading and vectorization are a thing, but IDK, the winner for math isn't c++/c.

surprise, it's fortran and OpenCL/CUDA. most of the 'fast' c/c++ libraries are wrappers.
what does raw number crunching performance have to do with operator overloading?

and yes when it comes to raw number crunching doing things on the gpu is much faste but there are situations where you dont need that much number crunching throughput but prefer to keep the data on the cpu side because you're doing a bunch of different things with them that cant be parallelized very well and also you may not be able to afford the latency of downloading the results back from the graphic card. its almost as if there was no single best tool for every task (there are lots that are bad at everything though)

Zlodo fucked around with this message at 23:11 on Sep 23, 2013

Zlodo
Nov 25, 2006

Nomnom Cookie posted:

I dunno why you're using the term pass by reference then. It has a clear meaning and deals with language semantics, not calling conventions.

I should just have precised I was talking about low level representation
see the problem is that i prefer to avoid the word "pointer" as well because its a loaded term too and people would have said "there's no pointer in java you dumbass"

quote:

Taking your meaning, which is "everything is a pointer", it's not an actual issue. Dereferencing pointers from L1 is basically free.
I disagree. the biggest cost might very well be the GC but dereferencing a pointer is significant enough compared to having the right value in a register in the first place, especially as value types allow compilers to store the fields of small structs directly into registers

of course like everything it only becomes an issue for things that are executed on many objects or in the inner loops of some algorithms etc but its nice not to have to worry about this particular performance hazard and be able to focus your efforts elsewhere

quote:

Bro you need to learn more about JVM internals if you want to poo poo on them. For starters, Hotspot allocates out of a thread-local buffer (imaginatively acronym'ed as TLAB). In the vast majority of cases Java allocations are pointer bumps.

OK, fine. that's a good, efficient way to allocate things. a nice thing when allocating things on the stack though is that freeing it is equally cheap. its just wasteful to reach for the heap for temporary objects

Zlodo fucked around with this message at 08:41 on Sep 24, 2013

Zlodo
Nov 25, 2006
auto completion is very helpful to write code but the advantage of making things more concise is that it also helps readability

Zlodo
Nov 25, 2006

did you do any profiling demonstrating that this closes the gap with c++ performance?

Zlodo
Nov 25, 2006

Mido posted:

please dont gtk

Adbot
ADBOT LOVES YOU

Zlodo
Nov 25, 2006
just use qt
also don't use python

  • Locked thread