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
Posting Principle
Dec 10, 2011

by Ralp
surely you meant to use a standard algorithm instead of writing a loop like a caveman

Adbot
ADBOT LOVES YOU

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

uG
Apr 23, 2003

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

FamDav
Mar 29, 2008

Zlodo posted:

you surely meant

for( auto&& thing : myList )

ftfy (which is interesting because in other cases universal references will not do lifetime extension correctly like with an xvalue)

FamDav
Mar 29, 2008
c++ has

lvalue
rvalue
xvalue
prvalue
glvalue

can you tell me what each one is

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

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

Zlodo posted:

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

maybe you should find a company that uses p-languages or j-languages so you don't have to work in a game sweatshop

Posting Principle
Dec 10, 2011

by Ralp

FamDav posted:

c++ has

lvalue
rvalue
xvalue
prvalue
glvalue

can you tell me what each one is

without actually looking it up I'm pretty sure that prvalues and glvalues are sub/supersets of r/lvalues +/- xvalues

Posting Principle
Dec 10, 2011

by Ralp
hmm I am kinda right in a vague sense but it turns out I have reading to do :negative:

Bloody
Mar 3, 2013

Zlodo posted:

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

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

Socracheese
Oct 20, 2008

i just python to do stuff and its real easy and i don't have to spend 12 hours debugging super vague errors and tedious pointer problems

the only thing i can think of doing with c that might be vaguely interesting is calculating stuff really fast with a GPU but I don't have any problems where time is a huge factor. like i could make a fractal zoomer or something but it would only run on windows if u have a nvidia video card

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)

prefect
Sep 11, 2001

No one, Woodhouse.
No one.




Dead Man’s Band

Socracheese posted:

i just python to do stuff and its real easy and i don't have to spend 12 hours debugging super vague errors and tedious pointer problems

the only thing i can think of doing with c that might be vaguely interesting is calculating stuff really fast with a GPU but I don't have any problems where time is a huge factor. like i could make a fractal zoomer or something but it would only run on windows if u have a nvidia video card

python is written in c, isn't it?




you were using c all along

:psyboom:

Socracheese
Oct 20, 2008

prefect posted:

python is written in c, isn't it?




you were using c all along

:psyboom:

yeah and its great because basically they wrote a wrapper over all the tedious parts of c so you don't have to worry about dumb poo poo

stoutfish
Oct 8, 2012

by zen death robot
if you want to write c, might as well go all the way with real asembley

uG
Apr 23, 2003

by Ralp
have you ever tried unicode string handling in asm?

uG
Apr 23, 2003

by Ralp
perl is also written in c lol suckers

Socracheese
Oct 20, 2008

stoutfish posted:

if you want to write c, might as well go all the way with real asembley

just do gcc -S on some fairly basic c file for a glimpse into how lovely that would be

Star War Sex Parrot
Oct 2, 2003

Socracheese posted:

just do gcc -S on some fairly basic c file for a glimpse into how lovely that would be
btw this is pretty neat

https://idea.popcount.org/2013-07-24-ir-is-better-than-assembly/

a cyberpunk goose
May 21, 2007

accept Forth as your one true language

a cyberpunk goose
May 21, 2007


owns

a cyberpunk goose
May 21, 2007

hey programmers: i've been using this nifty Haxe thingy

it's an offshoot of actionscript 2 which you'd think would be awful and there is some goofy syntax wangdiggery but on the whole the whole project seems really well thought out and a lot of the library support for it is surprisingly good

you can write your code once using a library like openfl for graphics, and it'll target compile to C++/swf/html5/neko binaries and not some VM-y thing

i've been having a fun :pcgaming: COMPUTER SCIENCE :pcgaming: journey with it and it's features

spongeh
Mar 22, 2009

BREADAGRAM OF PROTECTION

Mido posted:

hey programmers: i've been using this nifty Haxe thingy

it's an offshoot of actionscript 2 which you'd think would be awful and there is some goofy syntax wangdiggery but on the whole the whole project seems really well thought out and a lot of the library support for it is surprisingly good

you can write your code once using a library like openfl for graphics, and it'll target compile to C++/swf/html5/neko binaries and not some VM-y thing

i've been having a fun :pcgaming: COMPUTER SCIENCE :pcgaming: journey with it and it's features

isn't haxe more like as3, or did they bolt strong/optional typing on top of as2 like adobe did?

gonadic io
Feb 16, 2011

>>=

Mido posted:

use singletons everywhere


everywhere

yep, did some type encoded lengthed array stuff the other day with GHC.TypeLits

felt like a real hacker importing GHC.* modules

fritz
Jul 26, 2003

Zlodo posted:

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

at work i got like an 800x speedup going from naive python to naive c for a particular thing and the devops/would-be asst mgr type refused to believe that one could ever get more than like a 10x speedup python->c

fritz
Jul 26, 2003

Socracheese posted:

just do gcc -S on some fairly basic c file for a glimpse into how lovely that would be


i think most of the 'c is just portable assembly' people have never really written (a) assembly (b) c

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

fritz posted:

at work i got like an 800x speedup going from naive python to naive c for a particular thing and the devops/would-be asst mgr type refused to believe that one could ever get more than like a 10x speedup python->c

lol but at the same time

if you did the whole thing in c it probably would have taken months extra

going from 80s to 10s is cool, but going from 8 months to 1 month is cooler

fritz
Jul 26, 2003

Cocoa Crispies posted:

lol but at the same time

if you did the whole thing in c it probably would have taken months extra

going from 80s to 10s is cool, but going from 8 months to 1 month is cooler

oh yeah this stuff is a whole mess of python w/ some compiled libraries, we're replacing one of the libraries for political reasons so i gotta re-implement the parts we touch, ive been keeping them in python when i can (and it is kind of nice for the old ego when my python is about 2x as fast as the library's c) but sometimes theres just no getting around it

i ended up re-reimplementing the naive c version w/ a fancier algorithm w/ better complexity, but i switched to c++ b/c its not worth hacking up yet another stack/queue/map/etcetcetc thing in c when the stl's right there

Bloody
Mar 3, 2013

ive got a c++ app i want to make multithreaded

dear god what the gently caress is this mess

loooooooooool

Shark Sandwich
Sep 6, 2010

by R. Guyovich
hope you like boost bro

Bloody
Mar 3, 2013

its even worse because the program is actually quite a bit of c as in no objects no design thought no anything good

boost looks scary, managing threads sounds lol

uG
Apr 23, 2003

by Ralp
im not sure you have the credz to judge c based on your commentz

a cyberpunk goose
May 21, 2007

Bloody posted:

its even worse because the program is actually quite a bit of c as in no objects no design thought no anything good

boost looks scary, managing threads sounds lol

a coherent design threads does not make easily

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
Use Java

a cyberpunk goose
May 21, 2007

i'm no wizard but theres some pretty cool approaches to threading our your program that require very drastic/interesting architecture changes,

like making a common 'task' base type and each thread in a pool is just handed a 'task' and told to make it go, then you break your poo poo into a nice service oriented communication driven model with events and clearly defined thread safe interfaces

might as well just dehumanize self and face to erlang etc. at that point

theres a buncha ways to do a thing

Posting Principle
Dec 10, 2011

by Ralp

Mido posted:

i'm no wizard but theres some pretty cool approaches to threading our your program that require very drastic/interesting architecture changes,

like making a common 'task' base type and each thread in a pool is just handed a 'task' and told to make it go, then you break your poo poo into a nice service oriented communication driven model with events and clearly defined thread safe interfaces

might as well just dehumanize self and face to erlang etc. at that point

theres a buncha ways to do a thing

http://en.cppreference.com/w/cpp/thread/packaged_task

Posting Principle
Dec 10, 2011

by Ralp
anyways read this: http://www.amazon.ca/C-Concurrency-Action-Practical-Multithreading/dp/1933988770

most of it is applicable to boost threads, since the c++11 threads were mainly designed by the maintainer of boost threads (the guy who wrote that book). big thing to know about is the new memory model if you're using c++11

GameCube
Nov 21, 2006

um what's so hard about HANDLE WINAPI CreateThread(
_In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes,
_In_ SIZE_T dwStackSize,
_In_ LPTHREAD_START_ROUTINE lpStartAddress,
_In_opt_ LPVOID lpParameter,
_In_ DWORD dwCreationFlags,
_Out_opt_ LPDWORD lpThreadId
); ???

Adbot
ADBOT LOVES YOU

Shark Sandwich
Sep 6, 2010

by R. Guyovich
needs more HRESULT

  • Locked thread