[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 315
Thread images: 29

File: hot_blonde_book.jpg (798KB, 2214x2560px) Image search: [Google]
hot_blonde_book.jpg
798KB, 2214x2560px
Previous thread: >>61200561

What are you working on, /g/?
>>
First for D.
>>
Second for Java
>>
>>61206576
D is Dead.
>>
>>61206585
Java is ugly and bloated. At least the early versions had some semblance of purity.
>>
>>61206586
What is the point of this shitpost?
>>
>>61206585
>>61206586

And Java is a Joke.
>>
>>61206599
Verbosity is beauty. Bloat is useful.
>>
Someone give me some programming /lit/ for their favorite language
>>
>>61206603
and rust is a mental illness
>>
>>61206603
Java succeeds at what it sets out to do, which is more than can be said for most languages.
>>
>>61206666
quads confirm
>>
Haskell > Java

Agree or disagree?
>>
>>61206723
Haskell > Java > everything else

I unironically believe this.
>>
>Try to learn Python (never done anything programming related before)
>Try to make a simple bookmarking script
>Get nothing but errors

Will it get better or should I just stop learning?
>>
>>61206564
>hot_blonde_book.jpg
How did she get those wrinkles? She doesn't look very old.
>>
>>61206734
It gets better.
>>
>>61206723
C++ > java > ... > haskell
>>
>>61206752
>language that takes 20 minutes to master
>good
>>
>>61206723
>>61206733
C > Scheme > Haskell > C++ > Other languages
>>
File: old_hag_langs.png (173KB, 600x355px) Image search: [Google]
old_hag_langs.png
173KB, 600x355px
Seems no one claimed first so I'll claim it for Fortran.
>>
>>61206765
which language is that?
>>
Can you guys recommend me good python tutorials? I know there's google, but /g/ is smarter
>>
>>61206765
>being pretentious about having wasted a lot of time on a useless language without even mastering it
>good
>>
>>61206783
1. First was claimed here >>61206576
2. First means the first post in the thread, not the first person to claim
>>
>>61206835
The dead can't claim anything.
>>
File: IMG_7092.png (1MB, 500x646px) Image search: [Google]
IMG_7092.png
1MB, 500x646px
>>61206576
>>61206585
>>61206586
>>61206599
>>61206603
>>61206618
>>61206723
>>61206752
>>61206775
What's is with all this shitposting. Where's the code.

>>61206666
Nice quads
>>
File: 1499116095527.jpg (563KB, 1250x1248px) Image search: [Google]
1499116095527.jpg
563KB, 1250x1248px
>tfw no one got the joke
>>
>>61206835
>1. First was claimed here >>61206576
Exactly. First was claimed by nobody, because nobody uses D.
>>
>>61206845
The nth post can't claim first where n =/= 1
>>
>>61206852
>What's is with all this shitposting. Where's the code.
you must be new here
>>
>>61206795
For all your shitty needs. Best to look around though :
https://www.learnpython.org/
>>
>>61206854
Please refer to 2. and >>61206867. The position of your comment in the thread must agree with the number you are claiming.
>>
File: ran_delinquent.png (25KB, 120x234px) Image search: [Google]
ran_delinquent.png
25KB, 120x234px
>>61206867
Since when do the dead get to tell others what to do?
>>
>>61206853
wtf is this from
>>
>>61206795
https://automatetheboringstuff.com/
Here you go.
>>
>>61206904
since the crucifixion
>>
File: Screenshot_54.jpg (47KB, 600x600px) Image search: [Google]
Screenshot_54.jpg
47KB, 600x600px
>>61206904
Ask someone who's dead, I didn't claim first.
>>
>>61206853
Is the the gravitational field of the Earth? Or magnetic field?
>>
>>61206794
I meant years, I'm on drugs
>>
C > Lisp > Haskell > Assembly > C++ > Lua >>> Java > Python > Rust > D >>> JavaScript > PHP
>>
File: ran_do_it_again.png (25KB, 275x198px) Image search: [Google]
ran_do_it_again.png
25KB, 275x198px
>>61206936
>>
>>61206564
Yet another gang of four pulls shit out of their ass and writes a book with it.
>>
>>61207039
C > Lisp > Julia > *
>>
>>61207002
earth's geoid, and it looks like a butt, located in poo in loo land
>>
PHP > asm > C >>> C++ > Python > Lua >>> Java > PHP >>> JavaScript
>>
Working with C.

Reading a file into a void* datatype, void * v.
Have memory in a char* datatype, char * c.

Want to copy void* data into char* like you would two char*s, i.e.
char *a,*b; while (xyz) { *a=*b; *a++;*b++; }

I know I can do memcpy etc. but it needs to be this way because I'm also going to check the data in the void* byte/bit for byte/bit.

I'd also like to see what each byte or bit of void* is. How would I do this? I can't do v[x] or *v like I would a char datatype.

Then I need to compare the data between the void* and char* with memcmp.
>>
>>61207113
>PHP twice
>>
>>61207113
>PHP better than all others
What did he mean by this?
>>
>>61207137
PHP is by definition the best language ever made, but it's worse than Java and better than JavaScript.
>>
>>61207114
Bitmask.
>>61207147
PHP can produce code rapidly. The only flaw is that it has too strict syntax. I wish someone would make a language like PHP, but more loose interpretation.
>>
>>61207150
Someone help a brainlet like me understand this
>>
I decided to learn how to program. I read K&R, C Primer Plus and C Programming: A Modern Approach and I still don't know what to do with what I've learned.
>>
>>61207180
PHP is by definition the best language ever made. You can produce code in it faster and easier than any other language. But when analyzed you get the result of it technically being inferior to Java and superior to JS.
>>
php is objectively best
>>
>>61207176
javascript!
>>
>>61207227
No, javascript is very very strict. The ideal language would be constructed with the design principle of, if it doesn't compile/run/work, it's the language's fault. So for example, a = b and a == b are syntactically identical and are evaluated based on context.
>>
>>61207273
you dont even need semicolons in js
a = function() { 
console.log("Hello") // oops forgot a semicolon!
console.log("World");
}

//but it still works!
a();
>>
File: 1482044387143.gif (2MB, 330x166px) Image search: [Google]
1482044387143.gif
2MB, 330x166px
>>61207273
>a = b and a == b are syntactically identical
>>
>>61207317
But all the following will error:
log("hello")
echo("hello")
print("hello")
console.log(hello)

And so on, and so forth. There's no language that does this.
>>
>>61206734
of course it will. How are you building this bookmarking script? whats it meant to do?
>>
>>61207356
so you want a language where you can smash your head on the keyboard and it still compiles and runs?
>>
>>61207356
I forgot
console.log hello

>>61207370
Yes, in principle. It would be fun to work with, you would essentially only be constrained by your tpying speed since you wouldn't even need to bother with spellchecking.
>>
>>61207273
>javascript is very very strict
JavaScript is probably the least strict language there is
>>61207356
>There's no language that does this.
When did you start learning your first language? 2 minutes ago?
>>
>>61207370
So basically VB6.
>>
>>61207436
Yes, but it's still very strict.

2 years ago.
Are there any?
>>
>>61207447
Doesn't vb6 have some degree of syntax validation?
>>
>>61207370
>smash your head on the keyboard
Don't say that in the mechanical keyboard thread
>>
>>61207449
>>it's probably the least strict language there is
>Yes, but it's still very strict
Are you braindead?
>>61207356
>Are there any?
console.log() is how you output things to the console in JavaScript, just like how you use printf()/puts()/whatever in C, print() in Python, Console.Write() in C#, etc.
What's so hard to understand about that?
>>
>>61207512
It's more strict than what it technically needs to be to be able to write code in it.

This is correct, and there's nothing directly wrong with it from the perspective of JS. But there are no languages with that feature in existence, which is sad.
>>
>>61207370

>Smash your head on the keyboard and it still compiles and runs?
Brainfuck? I made a Brainfuck compiler in Ruby. It doesn't produce any errors except for an unmatched [ or ] character. Since every character other than the original 8 is considered a comment, you could smash your head into the keyboard and produce a valid program.
>>
>>61207485
does that damage the keyboard or something?
>>
Let's say I have a function that randomly will spit out a boolean so that my already threaded worker can pile it ontop of his job
Now, how is the best way to share data to a threaded function that will receive it without warning. I've always done a queue but that never felt right.
Just did some reading on namespaces, they seem like the holy grail to this type of thing or am i getting too excited?

Doing this in python 3.
def worktodo(barbool):
while(True):
if barbool:....
else:....

t1 = threading.Thread(target=worktodo, args=([ ]))
t1.start()

def foo():
for i in range(100):
if random.randint(1,2)%2==0:return true
else:return false


Yeah I know above code can be done more concisely, just making it easier to see it out and making example on the spot. Passing logic to a threaded worker like that is what i'd like to do cleanly.
>>
>node
>electron
>bootstrap
>angular
>jquery
>atom
Where did it all go so wrong?
>>
Working on a cyberpunk imageboard, 4kev.org
>>
>>61207851
I have something similar
https://2hu-ch.org/t/b4fbf063b78fca751e2822d027ce7ea8d6718cf6/#3890a5420c7dbd7d45fcfdbe618716f66b5fb648

been tweaking the css to add gimmicks
I need more ideas, IDEAS ARE HARD D:
>>
i hate javascript so fucking much
>>
which would be faster?

void updateCount(int& count, int a){
switch(a){
case 0:
count--;
case 1:
count++;
}
}


or

void updateCount(int& count, int a){
count += a * 2 - 1;
}


'a' must be an integer because it is the result of digitalRead() in the arduino (actually it is an ATtiny85).
I can't really test the result myself.
>>
>>61207909
The next time you're gonna unload your jealousies and inadequacies online, here's a little piece of advice. Here's a little piece of advice, slick. Next time you're gonna go on the computer (mommy and daddy bought you a new computer!), you're going to unload your jealousy and inadequacies on somebody else, on a stranger? Just make sure you don't pick Sam Geno, the son of the Papa Geno Pizza empire. I've bought people like you. I've destroyed people like you.

It's nothing for me to call up my father, and have every pizza jockey in the nation have a photo of you, right above their oven. Thinking about you, my personal army of pizza makers. They'll put sauce on you. They'll lay you out. Swing you around in the air just like in the old movies. Then they'll destroy you. Piece by piece. Piece by delicious piece. Cheesy piece by cheesy crusty piece. They'll destroy you. That's option one. Option two is you can apologize to me. Just say you're sorry. Takes a big man to apologize, don't it?!?! Humble yourself before a god, a pizza god!?!?
>>
>>61207939
Good lord, aren't you splitting hairs at this point?
>>
>>61207939
ps.: I forgot the break
>>
>>61207939
the first one is more lines
>>
I've been hired to write Xamarin apps. Should I off myself or is this shit gonna be bearable?
>>
>>61208078
sounds fucking awful
>>
imagine liking javascript
>>
>>61207114
you would have to cast the void* to something before accessing individual bytes

 char *cv = v;
cv[0] = cv[1];
>>
>>61208115
I cant
>>
File: cantwakeup.jpg (26KB, 632x455px) Image search: [Google]
cantwakeup.jpg
26KB, 632x455px
>>61208115
>>
>>61208115
It can be quite usable for some simple tasks when treated as a functional programming language. Any more than that and it quickly goes to shit.
>>
>>61208215
There are better functional languages more usable for simple tasks
>>
>>61208251
Once you're familiar with all the things that are wrong with it, it'll do the job just fine. Web developers generally already have it available in their working environments, so it can make sense for them.
>>
>>61206576
Second for D
>>
can /g/ design a programming language?
>>
>>61208362
lets start by slapping buzzwords together until we have a framework:

>statically typed
>>
>>61208362
It's been tried several times. The most successful one by far was the feminist variant of c++.
>>
Suppose I have a ternary that checks if int 'a' or int 'b' is greater than 10.


return (a > 10 || b > 10) ? true : false ;


I feel as if typing out " > 10" twice is rather redundant. Is there a way I could tie int 'a' and int 'b' together? as if I were trying to say:


return ((either a or b) >10) ? true : false;


I've done some googling around, but no luck.
>>
>>61208394
For a start you should be able to express that as just

return (a > 10 || b > 10);
>>
>>61208405
My question still stands. If it's not obvious, im a beginner.
>>
>>61207939
https://godbolt.org/g/tfXd3t
>>
>>61208389
can you link to the languages? or did they not get beyond a logo?
>>
>>61207939
Probably the first one when compiled to a jumptable.

But you should always benchmark when optimizing anyway.
>>
>>61208416
You mean in C? No. What you want is some kind of pattern matching and C doesn't do that.
With pattern matching, you'd have
match (a,b) with (10,10) -> true | _ -> false

And you see, this is not that much more compact than the C version.
>>
>>61208435
https://bitbucket.org/FeministSoftwareFoundation/

It got removed from github for obvious reasons.
>>
>>61208371
>duck typed
Okay our language is now "statically duck typed"
How does this work
>>
redpill me on monodevelop

is it a meme?
>>
>>61208449
oops, didn't match the cases where a and b are more than 10.
>>
>>61208449
I'm using java, but does it still apply?
>>
>>61208394
nice bait but I'm compelled to answer

>return (a > 10 || b > 10) ? true : false ;
just write
>return (a > 10 || b > 10);

Now on to your question, write a helper function that takes in a predicate and a list of values and does it for you.

any(fun, list) { 
for value in list {
if (fun(val)) {
return True;
}
}
return False;
}

return any(> 10, [a,b])
>>
>>61208416
return(a>10 || b>10) is probably as much as you can simplify it in a c based language
>>
>>61208416
There's no sensible way to do that in most commonly used languages. What you have already is simple and easily understandable, so keep it that way.
>>
>>61208453
dependently typed, too
>>
>>61208471
>>61208470
>>61208465
>>61208449
Thanks for the quick responses, helps a new CS student out a lot
>>
>>61208371
>>61208453
>>61208475
if we are gonna be hip with the kool kidds we need to have
>"moan ads"
and
>"lamb duhs"
>>
>>61208394
You could do
max(a,b) > 10
in this case.
>>
>>61208475
what are the advantages of dependently typed
and dont define the nats in the type, that's just absurd and useless
>>
>>61208453
the dead duck language
>>
File: yukari_armpit1.png (532KB, 714x478px) Image search: [Google]
yukari_armpit1.png
532KB, 714x478px
>>61208394
Define Kronecker delta:
int kronecker(int x)
{
if(x >= 0)
{
return 1;
}
else
{
return 0;
}
}

Then
return (kronecker(a-10)*kronecker(b-10) ==
1);
>>
File: duck-under-water-life-class-3.jpg (33KB, 735x559px) Image search: [Google]
duck-under-water-life-class-3.jpg
33KB, 735x559px
>>61208503
top fucking zoz
can our logo be a clipart version of this
>>
File: yukari_messy_eater.png (655KB, 624x804px) Image search: [Google]
yukari_messy_eater.png
655KB, 624x804px
>>61208508
Shit that gets you if(a>10 && b>10). It should be
return (kronecker(a-10) + kronecker(b-10) > 1);
>>
>>61208554
>=*
>>
>>61208514
you're only allowed to release new major versions when the language is "dead in the water"
>>
>>61208453
You have to declare that a method is duck typeable. For example, the "+" method on integers, floats, etc. is declared as being duck typeable. In cases where the meaning of a method isn't as clear, you wouldn't make it duck typeable.
>>
>>61208503
>>61208514
>dead duck typing

So maybe a language which calls generalised destructors selected based on the public attributes of a class.
>>
>>61208582
Duck typing should be reserved for macros and runtime evaluation
>>
File: 1422843106122.jpg (91KB, 800x800px) Image search: [Google]
1422843106122.jpg
91KB, 800x800px
>>61206564
>there are actually people, in this very thread, who have read this book
>>
>>61208453
everything will be done in terms of interfaces. if a function needs, quack() and waddle(), its type will reflect that and only will accept types that have quack() and waddle()

empty foo({quack :: any, waddle :: num -> any} bar) {
bar.quack();
bar.waddle(2);
}

data Duck {

void quack() { ... }
bool waddle(int a) { ... }
void swim() { ... }

}

foo(duck); // fine
foo(2); // compile error
foo("Hello World") // compile error
foo(/* anonymous data that defines quack and waddle */); // fine
>>
The /dpt/ lang should have RAII and be homoiconic
>>
File: 1499116111219.jpg (548KB, 2214x2560px) Image search: [Google]
1499116111219.jpg
548KB, 2214x2560px
>>61208620
fix'd
>>
>>61208362
>it's a Lisp/Scheme

done
what do I call it
>>
>>61208627
import Socks.Purple
>>
>>61208692
cringe
kys
>>
>>61208627
We get it already, you're homo(iconic).
>>
>>61208695
>kys
cringe
>>
haskell!
>>
>>61208796
shitpost!
>>
>>61207939
Looking at godbolt and instruction costs it definitely seems cheapest to do a*2-1. I even tried making a lookup table of {-1,1} and adding from that
>>
Making a game with C++, SDL and OpenGL, using Haskell as an embedded scripting language
>>
>>61208851
For real? How did you embed it? Post scripts
>>
>>61208869
it is a joke
>>
>>61207939
The second would be faster on a modern system due to no branching. No idea about your ATtiny85.
>>
>>61208902
xD
>>
File: 1472269721369.gif (1005KB, 540x304px) Image search: [Google]
1472269721369.gif
1005KB, 540x304px
>>61208796
good post
>>
>>61208851
Funny you should say this (even if it's a joke), as I'm making a game with Rust and SDL, using Scheme as an embedded scripting language. No OpenGL yet, I'm just trying to make a simple 2D game.
>>
>>61208998
>Scheme as an embedded scripting language
Which implementation?
>>
Someone just contacted me with an opportunity to convert an excel "database" into a webapp.

How hard can this be?
>>
>>61209050
do you really want to find out the answer to that?
protip: bill by the hour
>>
>>61209010
MIT/GNU.
>>
>>61209050
What does this have to do with programming?
>>
>>61206585
what are the best books to learn java?
>>
>>61208620
An SE professor at my university uses that book as the primary text for the class. He accompanies it with worksheets where you essentially fill in the blank from a direct quote from the text. Incredibly easy course as a result, but a few alumni have interviewed me and just forewent the SE questions after hearing he still taught the course.
>>
>>61209101
I generally have trouble estimating how many hours I will take in order to accomplish something. How do you do it?

It's the financial side of the project that I'm most concerned about but I think it could be interesting.

>>61209162
It's more related than 99% of the posts on this thread.
>>
>>61207851
nigga the css is ugly af
>>
>>61209342
Why do you type like a fucking retard?
>>
>>61209392
he doesn't??
>>
>>61209403
tchu sayin boi?
>>
>>61209272
I was insinuating that you should bill hourly and estimate only as an estimate, i.e. be able to bill for as many hours as you need
>>
>>61207851
Cool that the site seems to work.

So, I noticed it resizes images with css rather than generating thumbnails. Do you validate images server side at least? Also, your CSS prioritizes form over function, and I'm not a fan of the form...
>>
First project in python. Goal is to scrape prices and email me based on if the price is <= . Everything works except the prices come in with the currency symbol ($). I can't seem to figure out how I can either avoid that symbol or work around it to compare the price to my If/Else?

Using BeautifulSoup 4
>>
>>61209629
rstrip?
>>
>>61209629
>Python
stopped reading
>>
>>61209653
You sir, are awesome.
>>
>>61209684
pretty sure rstrip only trims trailing characters

if you can't get it to work try replace, like:

str.replace("$", "")
>>
>>61209750
rstrip strips from the right.
There is lstrip as well.
>>
>>61209758
Oh, neat. Never really gave thought to what 'rstrip' actually meant.
>>
Do you want to be part of something great?
>>
>see job posting
>they're offering $401K for a web dev job

you wot?
>>
>>61209792
u best be avin a giggle m80
>>
>>61209780
Sure.
>>
What's the male equivalent of a girl getting flowers?
>>
>>61209841
A man getting sex.
>>
is lisp the way to job security?
unlike many other other languages lisp possesses natively(you don't have to define them yourself or implement them with assembly or some shit) many powerful features to define its own syntax.

if you get yourself installed in as a programmer at some company and write a system critical to company performance that works extremely well but no one could possibly understand but you(due to writing a lisp programming syntax which is readable to nobody but you), doesn't that make it so the company pretty much can't fire you unless they're prepared to make someone recreate everything you've done? as opposed to using another language where anybody else fluent in the language would be able to sit down and take over your job.

it's almost like a way to copyright/say "this software is mine" without even needing any law, so long as you can write up a mysterious enough syntax.

i wonder, does this say something good or bad about lisp?
>>
>>61209864
>get hired
>write this in Java or we'll find someone else to do it
Foiled again
>>
>>61209941
>write it in lisp in a tenth of the time
get fucked, managers
>>
>>61209973
Does anyone actually think a high level programming language used today can be more time efficient by a factor of ten for the same quality code compared to everything else?
>>
>>61209864
i didn't think about it when writing that but just the situation itself would give you a lot of power beyond being layoff-immune, wouldn't it? "give me a raise" followed by a less directly phrased " or else i'll leave and this entire system is going to become inoperational, and no one will be able to come in to fix it or work with it again but me unless they redevelop it from scratch which will take god knows how long."

and since there aren't many business-involved people who understand lisp or even know what it is(probably) nobody who wasn't a programmer+knew lisp would even know you were designing such a system.

i realize that i'm a pretty scummy thinker. i can't help it.
>>
>>61209864
And people wonder why employers don't give lisp a chance. Christ
>>
>>61209996
Yes, easily.
>>
File: xamarin.jpg (55KB, 244x318px) Image search: [Google]
xamarin.jpg
55KB, 244x318px
Do I need any of this optional shit to build programs with Xamarin? The emulator alone is over 20GB but I have a phone so it can all fuck off right?
>>
>>61210022
Sorry, I don't have enough serious posts in this thread that I can directly attribute to you. As a result, it's a lot easier to just assume you're trolling than to try to make some points and risk having them ignored, since you weren't trying to have a real debate in the first place.
>>
>>61209841
A man getting flowers.
>>
is getting into security a waste of time now that rust is gaining traction?
>>
File: file.png (27KB, 858x934px) Image search: [Google]
file.png
27KB, 858x934px
conaway's game of life
>>
>>61210136
>rust is gaining traction
when will this meme end
>>
>>61210059
You'll need the Android and Java SDKs assuming you're targeting Android devices.
>>
>>61210136
Yes
>>
File: 1496358981591.png (784KB, 899x899px) Image search: [Google]
1496358981591.png
784KB, 899x899px
>>61210136
Goyim, you can't let this happen
>>
File: 137593505136.jpg (61KB, 600x800px) Image search: [Google]
137593505136.jpg
61KB, 600x800px
>>61210162
>in a gui
>>
>>61210200
you can pass in whatever view you want as long as it implements setState(x,y,alive)
>>
wtf is even the point of an alternate installation path for visual studio if it's still going to dump the majority of files in c:\program files FUCK I hate these people
>>
>>61209864
>is lisp the way to job security?
Yes, but for the less interesting reason that there are fewer lisp programmers out there. That is assuming you're not intentionally obfuscating your code, which can be done in any language.
>>
>he doesn't call himself a "Turing Machine disk jockey"
>>
>>61210300
>he doesnt call himself a Technology Samurai
>>
>>61207839

Tell me what is wrong with atom.
>>
http://www.strawpoll.me/13351061
>>
>>61210392
cuckpoll
>>
>>61210085
I think he meant write it in less time, not have it run at a tenth of the time
>>
>>61210367
JS
>>
>>61208620
their java book isn't so bad
>>
>>61207839
>atom
User friendliness. Using HTML and CSS is very comfy in comparison to Qt and GTK. I believe Sciter has recongnized this but the dev decided to hold back technology and closed off the source. Now it's dead.

So I talked to a few Rust folks. This is because some of them are working on servo. I was suggesting why we don't fork servo (Atom shell is a fork of chromium). Servo is basically a gaming engine and it utilizes GPU far more than any other web rendering engine.

Alas, it turns out that HTML is not a cost free abstraction over the GPU. So I am back to square one. I'm thinking of designing a modern fork of QML/Qtquick that does not rely on JS.
>>
what's the best resource on C++ for someone who already knows C?
>>
>>61210569
Why the hell would you want to learn C++?
>>
>>61210569
C++ is harmful
>>
>>61210569
Accelerated C++
Then read about C++14 and C++17 features.
Read some Effective C++ for quirks and tips.
>>
File: 1497412261.png (330KB, 706x535px) Image search: [Google]
1497412261.png
330KB, 706x535px
>>61206564
writing my own text editor in C
>>
What's the best resource on C for someone who already knows C++?
>>
>>61210574
because many popular programs are written in C++
>>
>>61210616
Throw your design patterns and OOP books into the trash then burn them
>>
>>61210652
C++ is a dying, poorly designed language, only used by bottom of the barrel programmers.
Learn something else.
>>
>>61206734
If you thought programmers spend all day programming, I have news for you. It is almost all debugging. Eventually it will work, and you will be proud.
>>
I need help on this turd called Xlib. I'm trying to upload an RGB buffer (not an image file) to the root X window background (a.k.a. the desktop background). To do that, I need to be able to copy the buffer into a pixmap, and looking in the X headers gave me no clue on how to do that since the pixmap structures are encapsulated in the server. How am I supposed to do that?
>>
>>61210684
90% of the software you are using right now including the browser you shitpost with is written with C++ as its core.
>>
>>61210700
>90%
That's blatantly false.
>the browser
I'll give you that, but there is not much else.
>>
>>61210684
linux, word, firefox, and chrome are all written in C++. i can't just refuse to know a language as common in important applications as C++.
>>
>>61210730
Linux is not written in C++. C++ is written in C
>>
>>61210706
Why don't you list all the programs you regularly use and what language they are coded in. Lets see what langauge has replaced C++ as it is a "dying, poorly designed language, only used by bottom of the barrel programmers."
>>
>>61210730
>linux
That's written in C, you fucking retard.
C and C++ are completely different languages.
>word
Where the fuck did I say I was using word?
>>
>>61210742
list 10 programs you've used today that AREN'T written in C++
>>
>>61206564
I had a mandatory SE course
it was just buzzwords and some burndown charts and knowing most time was spent on maintaining after deploying rather than developing software

that course made me want to quit life and made me happy I am at least not going into software
>>
>>61210751
No him
Linux
GNOME/gtk
Systemd
GCC
tar
Evince
Gedit
Nautilus
GNOME-Mplayer
Polari
>>
>>61207939
Please do not worry about this unless your debugger tells you that it is a significant time sink. It probably isn't and worrying about this shit will get you fired.
>>
>>61210772
Such popular softwares and programs. Surely a large marketshare right there. C++ is dead and gone.
>>
>>61210706
What about that shitty framework you use to develop games (Unity, Unreal Engine)

Those shitty AAA games you play BF, Rainbow Faggot Six Siege and CS GO.

The Google core infrastructure.
GCC, G++.
>>
>>61210494
>folks
This is a communist word, stop using it
>>
>>61210795
>Moving the goalpost THIS hard
>>
>>61210772
GCC was rewritten in C++ https://lwn.net/Articles/542457/
>>
>>61210807
Are you a fascist?
>>
>>61210740
>>61210751
Here is a screenshot of my currently running processes, and what languages they are written in.
Most of the root programs are written in C as well.
>>
>>61210815
That article was a paid falseflag, probably sponsored by Microsoft
>>
>>61210813
>>61210813
>C++ is a dying, poorly designed language, only used by bottom of the barrel programmers.
>Proceeds to give a list of literal who programs
>Gets called out
>Wah wah moving goalpost
Hilarious
>>
>>61210820
>C++ is dying
>Proceeds to give a list of programs written in fucking C
Lmao.
>>
>>61210832
>C++ is a dying,
True
>poorly designed language,
Very true
>only used by bottom of the barrel programmers.
Very, very true
C++ is a horrible language. It's made more horrible by the fact that a lot
of substandard programmers use it, to the point where it's much much
easier to generate total and utter crap with it. Quite frankly, even if
the choice of C were to do *nothing* but keep the C++ programmers out,
that in itself would be a huge reason to use C.

In other words: the choice of C is the only sane choice. I know Miles
Bader jokingly said "to piss you off", but it's actually true. I've come
to the conclusion that any programmer that would prefer the project to be
in C++ over C is likely a programmer that I really *would* prefer to piss
off, so that he doesn't come and screw up any project I'm involved with.

C++ leads to really really bad design choices. You invariably start using
the "nice" library features of the language like STL and Boost and other
total and utter crap, that may "help" you program, but causes:

- infinite amounts of pain when they don't work (and anybody who tells me
that STL and especially Boost are stable and portable is just so full
of BS that it's not even funny)

- inefficient abstracted programming models where two years down the road
you notice that some abstraction wasn't very efficient, but now all
your code depends on all the nice object models around it, and you
cannot fix it without rewriting your app.
>>
>>61210843
C and C++ are not the same thing, you idiot.
>>
>>61210832
>GCC
>Literal who programs
I want /v/ to leave right now
>>
C++ is a mediocre language
>>
>>61208455
>Redpill
Jesus christ some of you people need to learn to think for yourselves. Picking tools is really not that hard. In fact, I'm going to break it down into steps for you.

1. Search for things that do what you need done.

2. Figure out which ones are the best for YOUR USE CASE. Seriously, this step gets missed way too often and is the reason for the ravenous plague which is mapreduce.

3. Test things. Use your computer to see if the good ones actually work well for you.

4. Pick your favorite. There are probably no 'wrong' options left at this point. Just start working.
>>
>>61210844
Hi Linus
>>
>>61210844
>C++ is dying
So why isn't Firefox now written in /dpt/'s favorite language Rust?
>>
>>61210772
A list of projects mostly on the older side mostly written in C hardly supports the claim that C++ is a dying language
>>
>>61210874
When Firefox was written Rust didn't exist. No one is going to re-invent the wheel. By your logic, why isn't ANY OS written in C++ if it was so good?
>>
>>61210886
>Its dying
>But no one is going to re-invent the wheel
>So all major programs written in C++ will continue to be maintained, updated and written in C++
>But its dying
:thinking:
>>
>>61209050
Step one,
Convert excel 'database' into actual database.
Step two,
Slap a database interface onto the frontend.
Step three,
Bill for three times as long as that actually took.
>>
File: 1491081808903.jpg (56KB, 945x482px) Image search: [Google]
1491081808903.jpg
56KB, 945x482px
>>61210885
You asked me to mention 10 programs that I used and so I did. How about you stop trying to move the goalpost so badly?
>>
>>61210898
>The same goes for C
>Thinking wrong.
>>
>>61210898
>will continue to be maintained
I highly doubt that. Rust has actually started to get into Firefox's code base. What's more interesting is that Servo is being written in Rust and not in C++

C++ couldn't replace C for the past 3 decades. And now it's fading away/
>>
>>61209629
Do you need to escape the $ in your pattern matching? Try proceeding it with a \
Report back.
>>
>>61210902
C pee pee BTFO once again
>>
>>61210136
>implying people still don't click on random word docs they got through email
>>
>>61210902
I'm a different anon. I'm just commenting that you named 10 programs which don't support your actual thesis. Anyone can fulfill a verbal task on a technicality. When they call you out for being stupid, you can accuse them of "moving the goalposts" but the fact is his post would be 10 pages long if he had to account for every form of retardation you could conceivably reply with in advance. It doesn't change the fact that you're just being stupid.
>>
>>61210959
>word docs
Found your problem
>>
>>61210967
>I'm a different anon.
Of course you are. And then I stopped reading your meaningless rambling.
>>
>>61210844
Don't you need to attach the licence to that copypasta in order to use it.
>>
>>61210844
>(and anybody who tells me
>that STL and especially Boost are stable and portable is just so full
>of BS that it's not even funny)
1) STL is stable and portable. You can break it, but only YOU can break it, by fucking misusing it. If you use it right -- that is, according to the documentation -- it doesn't break.
2) Boost isn't stable or portable but who the fuck uses Boost they are brainlets let me punch them C++14 has everything you need from Boost fuck off with your Boost it's a useless pile of crap.
>>
>>61210982
I actually think Java programmers are better than C++ "programmers".

C++ users are at the same IQ level as Go.
>>
>>61210874
You didn't hear this from me but parts of it already are
>>
>>61211006
C++14 is literally boost
>>
>>61211023
Yeah, except stable and portable.
And not shit.
>>
File: 1498408261711.jpg (128KB, 600x1005px) Image search: [Google]
1498408261711.jpg
128KB, 600x1005px
>>61211030
C++ is not stable at all. And it's utter feces.
>>
>>61211007
>Same IQ level as Go
You didn't get hired at google. Maybe you should accomplish something programming before criticizing the way successful people do it.
>>
>>61211006
Are you actually implying Boost is not a C++ standard library?
>>
>>61211026
That's invalid C++, fuckboi.
Stop being retarded and use C already.
>>
>>61211039
>C++ is not stable at all.
It is. It functions according to its specification. How is that anything but stable.
>inb4 instability caused by going against the specification
That's your fault for going against the specification.
>And it's utter feces.
It's not though.
>>
>>61211044
>successful people do it.
dumb* people do it
>>
>>61211047
Obviously. It's not. It's garbage. Whereas C++ isn't.
>>
What is wrong this code, sorry if it's a simple blunder I am coming from Python and don't know how * or things work or why.

#include <iostream>
#include <vector>
using namespace std;

int *fibArrIter(int n);
int *fibArrDyn(int n);

int main() {
int n = 12;
int arr_arr[2][n];
arr_arr[0] = fibArrIter(n);

/* for (int i = 0; i < 2; i++){
for (int j = 0; j < n; j++){
cout << arr[i][j] << ", ";
}
}*/

return 0;
}
int *fibArrIter(int n){
int arr[n] = new {1, 1}; // Sets first two elements

for (int i = 0; i < n - 2; i++){
arr[i + 2] = arr[i + 1] + arr[i];
}

return arr;
}


I am trying to rewrite a Python program with 2 different types of fib functions and print them out, however I am having trouble just assigning the output of the first function I wrote to a variable arr_arr.
>>
File: 1453302491365.png (129KB, 314x278px) Image search: [Google]
1453302491365.png
129KB, 314x278px
How is piling shit onto a pile of shit supposed to make it less shitty?
>>
>>61211056
Now that's a good quality mental gymnastics
>It's stable I swear
>Why would you go past my brainlet walled garden?
>>
>>61211073
Still invalid, fuckboi.
>>
>>61211067
Boost is known as std beta. Boost is more like C++ "insiders" and then a few years later gets directly implemented in C++. C++ and Boost share the same members in their committee
>>
>>61211088
Yeah no shit, trying to find out why.
>>
>>61211073
>int arr_arr[2][n];
This does not actually declare an array of 2 arrays of n ints each. It declares an array of n*2 ints, and gives you syntactic sugar to make it accessible as though it were an array of arrays.
If you want an actual array of 2 arrays, you'll need this:
int *arr_arr[2];

There's no way to specify the length of the sub-arrays this way, but that's alright; the compiler doesn't need to know the length of the sub-arrays, because it knows the sub-arrays will be allocated elsewhere. Which they are: they're allocated in fibArrIter.
>>
>>61211115
I'm on my phone right now and can't scroll through code because 4chan CSS sucks but when I get home I can probably help if someone hasn't already
>>
>>61211080
If you write C++ that compiles and does something but does not conform to the standard, you are not writing valid C++. In fact, because the C++ you are writing is invalid, it is not C++. So if you criticize the behavior of the language you are writing, it's your fault for trying to compile that language with a C++ compiler.
>>
>>61211102
>Boost is known as std beta.
I don't care what they call it, it's shit. I could call shit "rainbows and sprinkles" and it's still shit.
>>
>>61211145
The std beta is valid C++ too. And it breaks left and right
>>
>>61211164
>The std beta is valid C++ too.
Wrong. """""""The std beta""""""" does not conform to the standard. Therefore it is not C++ at all.
>>
I saw this >>61211096 on fglt and was intrigued. How is GNU coreutils yes so fast? Can anyone write a faster yes than GNU in C?
>>
>>61211173
>does not conform to the standard.
But the newer standard is going to include std beta anyway, what's the matter?
>>
>>61211184
I tried to write my own as simple as possible
void main() {
while(puts("y"));
}
Which only gets 150mb/s, same as busybox yes.
>>
>>61211193
The newer standard is not yet the standard and does not yet conform to the standard. Therefore it is not yet C++. Whatever it is is free to be as broken and self contradictory as it likes, but I guarantee that once it's C++, it will be stable (as in it will operate according to its specifications).
>>
>>61211210
>but I guarantee that once it's C++
Yeah sure. It's magic after all
>>
>>61211229
It's not magic, it's just logic. Once it's C++, it will be stable. I can say this with certainty because if it weren't stable, it wouldn't yet be C++. There has never been a version of C++ that was the standard and was also self contradictory or otherwise impossible to implement correctly. There have been versions of C++ that were self contradictory or otherwise impossible to implement correctly, but they were never the standard.
>>
>>61211184
They buffer it themselves, instead of using the stdio buffering.
You can look at the source code; it's only 128 lines long.
It does use a god-awful GNU coding style, though.
>>
>>61211073
Is this what you want?

#include <iostream>

int *fibArrIter(int n);
int *fibArrDyn(int n);

int main() {
int n = 12;
int *arr_arr;
arr_arr = fibArrIter(n);

for (int i = 0; i < n; i++){
std::cout << arr_arr[i] << (i < n-1 ? ", " : "");
}

delete[] arr_arr;

return 0;
}
int *fibArrIter(int n){
int *arr = new int[n];
arr[0] = 0;
arr[1] = 1; // Sets first two elements

for (int i = 0; i < n - 2; i++){
arr[i + 2] = arr[i + 1] + arr[i];
}

return arr;
}
>>
>>61211247
What's wrong with GNU coding style? I know it can be bloated but it seemed fairly simple and logical, with tons of clear comments last time I had a look at their stuff (other than GCC).
>>
>>61211282
I think it's too late for you.
>>
>>61211249
Was going to have a second array from fibArrDyn and I just wanted to print them both out to see if they behaved correctly.

The above advice from >>61211126 helped but now I was having trouble in the function with the arr assignment.

Can you explain every part of the below?
the * and new keyword specifically.
int *arr = new int[n];
>>
>>61211294
please explain. Feel free to provide an example of gnu spaghetti code, it's been a while since I've read any of it.
>>
File: h.gif (374KB, 400x400px) Image search: [Google]
h.gif
374KB, 400x400px
there he go
>>
>>61211312
You assign memory for n int's.
int *arr defines a pointer to a memory location, in that line the memory region allocated by new is assigned to arr.

arr is a variable containing a memory address, to access its value you use the deference operator * or in case of a space with adjacent items (array) [].
*(arr) would be the same as arr[0] in this case.
*(arr+n) would be arr[n].

Any memory assigned through new has to be freed later by using delete. If it was assigned with the new[] operator you have to use delete[], otherwise for memory allocated with new use delete.
>>
>>61210874
>/dpt/'s favorite language Rust?
Crossdressing != being trans
>>
>>61211401
friend being trans != rust
i am trans and use haskell
>>
>>61211401
That's like getting worked up over the differences between a dog and a slightly larger dog.
>>
>>61210844
The only language that enables horrible programmers more than c++ is Java. Java is a much better designed language than c++ and yet it's even easier to generate absolute garbage code with it.
>>
>>61211413
>That's like getting worked up over the differences between a dog and a slightly larger dog.
>dog
Oh I see what you did
You changed the first two letters
>>
is c++ really that bad lads
>>
File: 1498117439711.png (753KB, 1338x5868px) Image search: [Google]
1498117439711.png
753KB, 1338x5868px
>>61211651
>>
>>61207546
>It's more strict than what it technically needs to be to be able to write code in it.
Hopefully english is your 4th+ language.
>>
File: 1498966480903.png (87KB, 975x522px) Image search: [Google]
1498966480903.png
87KB, 975x522px
Does Rust have Mixins/Template mixins like D? :^) No? Thought so.
>>
>>61211662
>tl;dr brainlet cant organize anything and muh looks bad
theres a reason c++ is the standard programming language for almost anything worthwhile
>>
>>61211706
Your tears are truly delicious
>>
>>61211701
>D
F
>>
>>61211706
That'd be Java
>>
>>61211651
I think it's a somewhat badly designed language, and the concept wasn't great to begin with, and it enables a lot of horrible practices and programmers, but if you know what you're doing you can do some good stuff with it. There are certainly reasons for its popularity.
>>
Why isn't Ruby as popular as Python? Ruby so much more comfy to program in and actually does stuff in a unique and interesting rather than Python's boring and unoriginal way of doing things.
>>
Unpopular opinion: Both C and C++ enables lazy and brainlet programmers.
Bring back ML.
>>
>>61211730
Python has more modules.
>>
>>61211408
I wanted to fuck a trap in my lifetime. Sadly there are no cute traps.
>>
>>61206564
Newbie to code here, I've been using freecodecamp to learn but I was wondering if there are any other sites that are is a better alternative?

So far I love the site, but maybe something better exists?
>>
>>61211785
Definitely don't take advice from 4chan
>>
>>61211785
No bully, but you're looking for web development general
>>
File: 10264303.jpg (126KB, 706x546px) Image search: [Google]
10264303.jpg
126KB, 706x546px
Did the gatekeeper die?
>>
New thread:
>>61211816
>>61211816
>>61211816
>>
>>61210569
I'd say learn something other than C++ if you know C.
>>
>>61206912
What if I don't do any boring stuff that could be automated?
>>
>>61207782
Why would you need a for loop?
Thread posts: 315
Thread images: 29


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.