[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: 393
Thread images: 32

File: sicp_anime_girl.png (176KB, 441x421px) Image search: [Google]
sicp_anime_girl.png
176KB, 441x421px
Productivity edition.
Old thread: >>60599509

What are you working on, /g/?
>>
File: d died.png (662KB, 940x590px) Image search: [Google]
d died.png
662KB, 940x590px
Why do people still use pure imperative languages?
>>
File: 1484985175199.jpg (120KB, 1091x815px) Image search: [Google]
1484985175199.jpg
120KB, 1091x815px
>OOP
>>
>>60605428
Any D fags here? How do you parse ints from stdin and store them in an int[]?
I tried
 tried    int[] n = readline().split().to!int 
but as I expected, it won't work because it is receiving an array, not each elements
>>
File: millennials.jpg (80KB, 532x796px) Image search: [Google]
millennials.jpg
80KB, 532x796px
Should I learn Rust or C++?
>>
>>60605458
Do you want a job? C++
Are you a trap? Rust
>>
>shitpost general
execellent start
>>
Whats a good way to transition from beginner just learning books to intermediate level stuff? Just keep hammering away at code or should I go with another book? Trying to learn python if that helps.
>>
>>60605464
Why do you think being a trap and having a job are mutually exclusive?

Also explain your reasoning.
>>
>>60605472
I think it's time for you to start crossdressing.
>>
>>60605483
at the same time it's time for you to stop crossdressing.

People have complained, don't blame me I'm just a relay, blame the messenger: >>60605483
>>
File: C++.png (72KB, 1016x98px) Image search: [Google]
C++.png
72KB, 1016x98px
What does this do?
>>
>>60605536
It memes an entire board.
>>
File: megumeme.jpg (111KB, 1000x871px) Image search: [Google]
megumeme.jpg
111KB, 1000x871px
>>60605536
qwantem EXPLOZION

please don't.
>>
>>60605536
Makes a resource. Obviously...
>>
File: sit.jpg (86KB, 703x583px) Image search: [Google]
sit.jpg
86KB, 703x583px
>>60605428
In Scheme is there a way to read data from a file during macro expansion time and apply a (syntax-rules) macro to it?
>>
>>60605452
int[] numbers = readln().splitter().map!(a => a.to!int).array;
>>
I was implementing Karatsuba algorithm in python as a exercise.
Been reading Algorithm Design all night. Cormen is a meme.
>>
>>60605590
What are they doing??
>>
>>60605590
Maybe if you can read that data at compile time.
>>
>>60605610
>algorithm
>range
>conv
Heh, I was looking for a short and quick way to achieve this but it seems all those imports defeat the purpose. I'll just stick to my linear-imperative practices.
>>
>>60605623
Sharing a toilet, it's common in japanese culture. It's like taking a bath with big breasted women and small children, common occurence.
>>
>>60605632
Yeah, we warned you. "F***tional" achieves nothing of value. Just do a foreach loop and get your ints from there
>>
>>60605635
Those fucking japs...
>>
>>60605590
Sauce?
>>
How do I remove sperm stains from my clothes? It's for a programming job interview.
>>
>>60605925
Suck the stain off with your mouth.
>>
>>60605925
Don't remove them just dress like a woman.
>>
>>60605957
They've solidified by now so there isn't anything to suck off.
>>60605969
But I need to.
>>
>>60605978
Lick it off.
>>
File: dlang_chan.jpg (139KB, 470x545px) Image search: [Google]
dlang_chan.jpg
139KB, 470x545px
Threadly reminder that dlang-chan is not dead; she's going to have her GC tumor removed (eventually); she's super duper cute; and she's a blast to write in! Say something nice about her, /dpt/!
>Features
https://dlang.org/comparison.html
>GC
https://dlang.org/spec/garbage.html
https://dlang.org/blog/2017/03/20/dont-fear-the-reaper/
https://dlang.org/blog/2017/04/28/automem-hands-free-raii-for-d/
>Standard library
https://dlang.org/phobos/index.html
>Books
https://wiki.dlang.org/Books
>>
>>60605996
rip
>>
File: 1494624067541.png (294KB, 562x562px) Image search: [Google]
1494624067541.png
294KB, 562x562px
>>60605428
Is there any reason to ever use the heap?
>>
>I can't code for my financial gains.
>I am stuck in solving every problem from the art of computer program and CLRS
How do I get out of this?
>Also, wtf is sandal
>>
>>60606022
stack/heap might not exist
>>
>>60606022
ID3D12 interfaces uses them.
>>
>>60605925
Bump
>>
>>60606130
>>Anime
>Hi.
>Go to hell.
Hi.
Go to hell.
>>
>>60606022
You wouldn't a matrix with few million elements on stack.
>>
>>60606235
You do realize you can adjust the size of the stack at any time, right?
>>
>>60606022
The stack already has a lot of things on it because it is used for functions. Putting stuff on the heap means you can pass data around outside of the scope of the function.
>>
>>60605925
cover all of the clothes with sperm so the stain doesn't stand out
>>
>>60606262
>you can pass data around outside of the scope of the function
And why would I want to do that? Sounds like bad programming.
>>
>>60606307

It's called returning a value -- something people do all the fucking time.
>>
>>60606328
???
No, they don't.
>>
>>60606337

The fuck do you think a function is?
>>
>>60606351
whatever you need it to be
>>
What hapen
>>
Oh poorfags can't post lel.
>>
File: 1452471092796.png (372KB, 1280x720px) Image search: [Google]
1452471092796.png
372KB, 1280x720px
>>60606442
>There are people in 2017 who are still contributing to the botnet.
>>
Dead programming thread.
>>
>>60606516
What? It's a thread about Ruby?
>>
f
>>
>>60606526
You take that back right now.
>>
File: 400px-IRL_the_game.jpg (48KB, 400x600px) Image search: [Google]
400px-IRL_the_game.jpg
48KB, 400x600px
Programming noob writing a very basic parser in Java using Scanner. I have a dozen of Token types. How to organize my code? Is it possible to expose a method in the classes to let the Scanner find them as a Token in a String? How to do that?
>>
>>60606572
Never.
>>
>>60606328
Why use Ruby when it is slow and inconsistent compare to a scripting like language like Go which is actually fast.
>>
File: 1495831598262.png (308KB, 640x480px) Image search: [Google]
1495831598262.png
308KB, 640x480px
>>60605428
A dialect of C with no I/O.
>>
testing
>>
>>60605536
X *p = new C(args);

// delete p using D later

where X is a unique_ptr, so it deletes it automatically using D (last argument to unique_ptr is a custom deleter function).

All that syntactic garbage is needed to make sure X's type is deduced correctly and args is forwarded without being copied or 'losing' any type information (C++ is so terrible that it sometimes decays or changes the type behind your back if you're not careful)
>>
>>60605536
>ReturnTypeReturnType
It probably doesn't even compile
>>
Hiro is a giant jew fuck. /dpt/ should make an inhouse captcha
>>
>>60607001
I'll make the logo.
>>
>no programming channels on disqus
fuck this gay earth
>>
>>60607029
>disqus
What?
>>
>>60605536
i think it declares a variable in C++
>>
>>60606022
To allocate dynamic memory, retard.
>>
>>60607032
https://disqus.com/

it's now used by many websites to implement commentary. it's also used for talking about many subjects. you can subscribe to a channel to then see its posts on your wall.
>>
>>60607104
>Website doesn't display anything with third-party JS disabled
What a fucking joke. I can tell just by that and it's fucking stupid name that it's fucking shit.
Stop being a retard and just use IRC.
>>
>>60607117
irc is shit and obsolete. disqus offer persistency, centralization, data integration, and avatars.
>>
Is there any purpose in
const void* foo
?
>>
>>60607184
>persistency
Set up an IRC bouncer if you care that much.
>centralization
How the hell is that a good thing?
>data integration
IRC has been able to handle files for a VERY long time.
>avatars
Literally who cares?
>>
>>60607187
Yes.
>>
>>60607216
Tell me
>>
>>60607229
You want to pass a pointer to some unspecified const value to some function.
For example. qsort/bearch uses that.
>>
>>60607204
>Set up an IRC bouncer if you care that much.
really? your solution to a problem is adding more problems? and disqus has complete persistency: your comments, other users comments, ... the complete discussion is kept

>>60607204
>How the hell is that a good thing?
now, i only have to visit my disqus home page to know if someone replied to me on any website using disqus. since many anime streaming websites are now using it, it really has changed my life.

>>60607204
>IRC has been able to handle files for a VERY long time.
by data integration, i mean that you can embed files but also youtube links, twitter links, ... in your comments.

>>60607204
>Literally who cares?
me. by seeing my avatar, you should have a idea of who i am. an avatar help you to dissociate from other users.

please, don't be a retrograde, accept disqus.
>>
>>60605479
traps can code in their spare time as a hobby, but they don't get paid to code, they get paid to pleasure faceless old men
>>
>>60607032
>>60607104
>>60607117
>>60607184
>>60607204
>>60607304
Not programming. Fuck off to some other shithole.
>>
>>60607304
>the complete discussion is kept
thank god i don't need to use this crap
>>
>>60607304
Why did (You) (You) me 4 times?
>the complete discussion is kept
Why do you need that shit? I bet you use reddit and love all of the "karma" or whatever following you around.
>anime streaming
AHAHAHAHAHAHAHAHAH
>by data integration, i mean that you can embed files but also youtube links, twitter links, ... in your comments.
You're literally talking about posting a hyperlink.
>an avatar help you to dissociate from other users
Right. A username/nick doesn't do that at all.

>>60607316
Thanks for the (You).
>>
>>60607349
>responding to bait
>>>/r/abbit/
>>
>>60607332
but you are still using irc where many channels have a logging bot

>>60607349
>Why did (You) (You) me 4 times?
because i select your text by double clicking then i click on your post number to quote you easily.

>>60607349
>Why do you need that shit? I bet you use reddit and love all of the "karma" or whatever following you around.
i couldn't care less about karma. i care about sharing opinions with other people on subject that interests me (socialization).

>>60607349
>AHAHAHAHAHAHAHAHAH
please, don't say that, especially when posting on this website. without anime, 4chan would not exist. this is the truth.

>>60607349
>You're literally talking about posting a hyperlink.
but it's embed like youtube links here.

>>60607349
>Right. A username/nick doesn't do that at all.
a poet and a painter talk differently to your soul.
>>
>>60607406
>please, don't say that, especially when posting on this website. without anime, 4chan would not exist. this is the truth.
No, I was laughing at the fact that you're a fucking stupid streamfag.
>>
>>60607304
>by seeing my avatar, you should have a idea of who i am
So an insufferable weeb?
>>
>>60607428
Anime is the fundamental part of imageboard culture and being disgraceful to the anime must be a punishable offence.
>>
>>60607438
avatarfagging is gayer than namefagging, faggot.
>>
File: snap-32.png (22KB, 852x467px) Image search: [Google]
snap-32.png
22KB, 852x467px
>>60605428
What the hell is up with GCC for ARM, it's emitting pure garbage, maybe 30% of the instructions could straight up be removed, and I'm not even picking the worst exemple.

Supposedly, this binary was compiled with size optimizations.
What the fuck, compiler people.
>>
>>60607438
I guess I was right
>>
>>60607451
>reaction images are ""avatarfagging""
So basically you're admitting that you're either a r*dditor or simply a retarded newfag?
>>
Any languages that can sleep(cycles)?
>>
>>60607473
pic18
>>
>>60607460
Garbage emitting pure garbage is reasonable.
>>
>>60607460
ARM focuses mainly on llvm.

>Those fucking captchas
>>
>>60607462
You must be new here, but I'm not the poster you were replying to.
>>
File: 2017-05-27-153705_390x566_scrot.png (188KB, 390x566px) Image search: [Google]
2017-05-27-153705_390x566_scrot.png
188KB, 390x566px
>>60607493
forgot pic
>>
>>60607509
>not using legacy captcha
kys
>>
>>60607498
Everyone is anonymous here, so it's not hard to confuse one insufferable weeb with another. You can be a weeb and not be a faggot about it
>>
>>60607487
>>60607493
I'm seriously talking pure shit code here, so bad the fucking assembler should refuse to take it as input.

This fucking piece of shit will create 4 stack variables in a function, write all the arguments into it, then NEVER FUCKING USE ANY OF THEM.

And then half the stack variables it writes and immediately reads back from it all the time, because why the hell not.

Sometimes it will just vomit 5 lines of garbage because it needs to use TWO FUCKING registers at the same time and OH MY GOD if you don't write it at least three times in two different places it's probably going to forget it still has the value right here in the god damned register.

Yes, I'm mad.
>>
>>60607304
>anime streaming
Among my entire reaction image folder I can't find even one that comes close to the disgust I currently feel towards you.
>>
>>60607531
Are you sure it was actually compiled with optimisations enabled?
>>
File: 1443322561145.gif (568KB, 240x291px) Image search: [Google]
1443322561145.gif
568KB, 240x291px
>no anime
... on an anime site.
You have a very low IQ anon.
>>
File: snap-33.png (68KB, 1343x396px) Image search: [Google]
snap-33.png
68KB, 1343x396px
>>60607550
It's a release version of firmware that I dumped/decrypted, long story. But I have the Makefile and it pretty clearly should optimize.

I don't even know.
>>
>>60607531
You deserve this for using G*U trash.
>>
>>60607582
Yeah I wish I had a choice. Not my binary/platform.
>>
>>60607580
You shouldn't specify multiple optimisation flags. -O3 or -Os, not both.
That doesn't explain the output though. I think it just takes the last option.
>>
>>60607606
Hm, that's possible, though I though they just expanded "-O3" and "-Os" into a bunch of other flags that enable the relevant optimizations.

Either way, even -Os shouldn't be that bad. You could clearly make the thing much smaller by removing all the garbage.

Maybe some idiot changed the Makefile when they built it, I don't know. What the fuck, tho.
>>
2 years C++ maintainence experience here.
How do you guys remember c++ stuffs?
While I was going through a book I found out I almost forgot "reference to array", "top level const" and "low level const", "const reference".

>feels bad
>>
>>60607642

by not being retarded
>>
>>60607642
Why don't you use a language which isn't ridiculously bloated, so you don't have to remember a bunch of pointless shit?
>>
>>60607642
I made fun and/or useful projects when I was learning C++, by actually using and needing things you remember them perfectly.
>>
>>60607669
This is what I have been thinking.
Programming everyday something the requires that concept.
>>
>>60607659
Normal people don't use a particular programming language based on how easy or hard it is. The market decides what programming language is relevant.
Trying asking indie game devs to make games for windows in C.
>Not a 34 year virgin working for government
>>
>>60605536
exactly as is, this will not compile as pointed out by >>60606918 - "ReturnTypeReturnType" should be "ReturnType". also note that the third line is unnecessary in C++14 onward, as return type deduction will deduce the type specified explicitly here. as for what it does:

given a creation function "c", a deletion function "d", and variadic arguments "args", returns a unique_ptr to whatever type "c" returns a pointer to when supplied with perfect-forwarded "args", with its custom deleter set to "d". its most obvious use case is as an RAII wrapper that adds exception safety and unique_ptr semantics to a C library type given the usual create/destroy function pair. as an example, say you are linking with a C library that defines the following (assume they do what you'd expect):

struct foo;
foo* create_foo(int, int);
void destroy_foo(foo*);


you could do the following:

auto f = make_resource(create_foo, destroy_foo, 2, 4);


"f" will be a unique_ptr<foo> that wraps a foo* created with the arguments (2, 4) which will automatically be destroyed when it goes out of scope (unless it is moved into another scope), including the case where an exception is thrown later in this scope, or if it is reset, reassigned, etc (in other words, it has unique_ptr semantics)
>>
File: lastestcaptach.png (351KB, 609x967px) Image search: [Google]
lastestcaptach.png
351KB, 609x967px
>>60607818
What C_+_+ book you follow?
I feel retarded reading your post.
>>
Is there something like Haskell but without the sepples aspects of it?
>>
>>60607999
>haskell sepples aspects
Go home Satan. You are drunk.
>>
>>60608025
It's too bloated and fundamentally (most likely irreversibly) crippled. It has a joke of a type system which can be outdone by a few thousand line toy language.
>>
>>60608076
Try standard ML.
>>
>>60608087
Already looking into it, but the second sentence still applies.
>>
>>60607877
as far as actual books go all i have is Stroustrup's The C++ Programming Language, which i recommend checking out if you haven't. but there's also a lot of good resources online:

cppreference.com
isocpp.com FAQ and blog
Herb Sutter's GotW series
the CppCoreGuidelines docs
Jason Turner's blog (EmptyCrate) and video series (C++ Weekly)
and conference presentations on YouTube (CppCon, BoostCon, etc)
>>
>>60607460
Is that IDA decompiler?
>>
>>60608109
That's just the disassembler, but yeah.
>>
>>60607877
>>60608099
oops, meant isocpp.org, not .com
>>
>>60608112
Do you think it would be possible to program a botnet that mines bitcoin or ethereum?
>>
>>60608159
That would be fucking stupid, you're 5 years late if you want to mine with a CPU, 3 years late if you want to mine with an ASIC
>>
>>60608178
I'd mine with the GPU, what if someone had like 3 servers of about 50k bots?
>>
>>60608195
You'll still be making fuck-all. Literally anything else will net you more money.

Do some ad fraud, I'm sure Google's got some spare change they can let go of.
>>
>>60608210
((B*m/hr)*24)*365

B - number of bots
M - mining rate/hour

times 24 hours times 1 year. You'd make a lot of money.
>>
>>60608254
Fuck all times 365 is still fuck all.
Go ahead and look up what the mining rate of your average GPU is in 2017, I'll sit here with a shit eating grin.
>>
>>60608254
>having your parents pay for electricity and hardware
>>
>>60608277
http://www.coinwarz.com/calculators/bitcoin-mining-calculator/?h=9460.00&p=2600.00&pc=0&pf=0.00&d=595921917085.41600000&r=12.50000000&er=2170.52030000&hc=0.00
>>
I have an idea for a new programming language.
I'll call it Shisp.
It's like Lisp, but it's shit because I haven't fully learned Lisp and yet I want to pretend I write Lisp.
>>
>>60608284
>wzgdcuck

I get chicken tendies and chocolate milk, you get a depressing dead end job inly to come home and drink your problems away.
>>
>>60605428

this fractal I generated is perfect for when you need icons that are 8x8, 16x16, 32x32....
>>
>>60608312
>wagecuck*
>>
File: alchemy-1.jpg (1MB, 1264x1037px) Image search: [Google]
alchemy-1.jpg
1MB, 1264x1037px
>>60605441
Because the underlying hardware is purely imperative.
>>
>>60608312
>shitposting irrelevant crap
stop
>>
>>60608315
looks like this
>>
>>60608296
brilliant
;; Shisp hello world program
(defun a () (b))
(defun b () (a))
(a)
;; It prints hello world eventually, just believe me
>>
>>60608315
Convert 0.999 into a fraction then to a decimal again.
>>
>>60608290
First of all, I don't know where you go those numbers, but according to https://www.nicehash.com/?p=calc an NVIDIA GTX 1070 which is pretty far from the average card you'll find on a bot, would net you 1500 a year if you ran it 24/7 all year.

That's the optimistic numbers, assuming your bot is always up and has the most expensive hardware you can buy.

And it's still shit returns.
The average cryptolocker asshole makes that in a week.
>>
I've only used Python, Java, some minimal JavaScript, and a little bit of PHP and I'm starting to learn C

Where the fuck do I begin? Memory allocation and header files are confusing as fuck to me
>>
>>60608381

What's confusing you senpai?
>>
>>60608381
Write a hello world, then write the price is right, then make a GUI, and whatever other project you want to do.

Just code and you'll learn as you go by reading the manual when you get stuck.
That's where you begin.
>>
>>60608377
I could mine ethereum and that will go up.
>>
>>60608381
>memory allocation
Literally not something you need to bother with at first, this comes later.

>header files
How is this hard? Stupid, yes. But not hard. You put the function definitions in a separate file so that ??? who knows C is outdated as fuck.
>>
>>60608405
You do you, I don't really care either way.
>>
>>60608381
Header files are used as convention for declarations, source files are used for the actual coding.
>>
>>60605590
No, because standard Scheme doesn't even define macros, only syntax-rules. It's probably possible in all practical implementations, however, though I wouldn't know how portable it would be.

Admittedly, the last time I read the Scheme standard was R5RS. Not sure if it has changed since then.
>>
>>60606258
Not if there isn't space available below it.
>>
>>60608408
>who knows C is outdated as fuck.
What's not outdated?
>>
>>60608359
But it falls in endless loop
>>
>>60608437
C#
>>
>>60608437

Anything with an import system.
>>
>>60608437
Rust
>>
>>60606022
To have values that can survive the dynamic extent of the function that created them.
>>
>>60608325
So?
>>
>>60608453
So an imperative mapping is the simplest and most direct mapping to it, which matters whenever performance matters.
>>
>>60608443
>#include
>>
Is it true that it's not gay if the boobs don't touch when they kiss?
>>
>>60608469
>being this ignorant
>>
>>60608469

>concatenating text files with a dumb preprocessor is the same as importing language symbols directly
>>
>>60608473
I want some boob, I'd grab those boobies and move them in a circular motion.
>>
Got a teaching degree and want to be a code monkey.

What do I do to get a office job with code? I'm new at python.
>>
>>60608500
How's it not?
>>
>>60608363

what did (you) mean by this?
>>
>>60608518
There are online quick training courses you can take those, they usually give you a certificate.
>>
>>60608540
0.999 = 1

I saw it on a list of paradoxes on Wikipedia.
>>
>>60608544
Any particular carts? Honestly just wanna make like 30-35k a year. Got a small house from teaching but that job is killer for the pay.
>>
>>60608583
Certs. Thanks phone.
>>
>>60608583
Look on youtube, I learnef by reading books and watching youtube videos, but there are actual online courses which test you. Most C++ prigrammers I knew learned from cpluplus.com.
>>
>>60608522

One takes a hour to compile, the other takes 5 minutes.
>>
>>60608599
dumb phone poster
>>
File: type_mismatch.png (28KB, 913x313px) Image search: [Google]
type_mismatch.png
28KB, 913x313px
I'm actually kinda enjoying it.
>>
>>60608178
what if i use the hpc of my univ?
>>
>>60608617
Doesn't mean shit it's the same thing, different language syntax.
>>
>>60608623
You just take more risk for the same low reward.
>>
File: 041248.webm (3MB, 540x960px) Image search: [Google]
041248.webm
3MB, 540x960px
>>
File: 48b.jpg (19KB, 578x213px) Image search: [Google]
48b.jpg
19KB, 578x213px
>>60608629
>this bad thing and this good thing are actually the same
>>
When is C++ finally going to get UFCS?
>>
>>60608637
wew, how long did it take you to make 2 LEDs blink anon? 5 hours?
>>
>>60608599
None thst I know of personally or in particular.
>>
>>60608645

What C++ needs is to be even more complicated and ambiguous
>>
>>60608381
>memory allocation
In Java, you could do this, right?
public class Foo {
public int bar;
public static void incBar(Foo baz) {
baz.bar++;
}
public static void main(String[] args) {
Foo bork = new Foo();
bork.bar = 12;
System.out.println(Integer.toString(bork.bar));
incBar(bork);
System.out.println(Integer.toString(bork.bar));
}
}

Expected output: 12, and then 13. Right?

Here's a naive C equivalent:
#include <stdio.h>
struct Foo { int bar; };
void incBar(struct Foo baz) {
baz.bar++;
}
int main() {
Foo bork;
bork.bar = 12;
printf("%d\n", bork.bar);
incBar(bork);
printf("%d\n", bork.bar);
return 0;
}

If you run THIS code, you'll actually get 12 and then another 12.

That's because in C, the bork passed to incBar is a copy. Java claims to be pass-by-value, and it is, but the values it passes are references. The parameter to a method and the external variable passed as that parameter are different references to the same object. C is pure pass-by-value: the variables don't store references, they store the object itself, and so passing the variable means passing the entire object -- plucking the whole thing right up from memory and scooting it over there.

(cont)
>>
>>60608657
Complicated in comparison to what?
>>
>>60608637
What field of study are yoj in?

>>60608655
How long would it take to make a droid army.
>>
>>60608666
That's because you're a nigger and do not understand pointers/pass by copy
>>
>>60608666

please stop
>>
>>60608657
C++ is pretty simple actually, you just have to have the patients to learn it, one programmer told me when I was learning it, you wont remember everything.
>>
>>60608666
Why doesn't Java have a return keyword?
>>
>>60608722

It does, it's just that main methods are void.
>>
>>60608629
it's really not the same thing. #include is essentially copy and paste, while import systems are much more involved. also, #include is not actually language syntax, it's a preprocessor command
>>
>>60608734
Oh okay. Been a while since I actually programmed, I see it now.

What is the poibt of classes anyway? To keep code orderly and organized?
>>
>>60608741
Yes, like #pragma region for example, it effects complie time, not run time. I still don't see a difference between import and #include. Is import run time or something?
>>
>>60608756
see
https://steve-yegge.blogspot.com.au/2006/03/execution-in-kingdom-of-nouns.html
>>
>>60608756

Kind of. In other languages you have separate mechanisms for simply keeping code together (C++ namespaces, Python modules) but Java merges that concept with the distinct OOP notion of a class.
>>
What's the big O notation for this? O(2n+n^2)?
import std.stdio;
import std.conv;
void main(string[] args)
{
int[] numbers;
foreach (arg; args[1..$])
{
numbers ~= arg.to!int;
}
numbers.find_gcd().writeln();
}

int find_gcd(int[] vals)
{
int smallest = vals[0];
ulong index_of_smallest = 0;
foreach (index, val; vals)
{
if (val < smallest)
{
smallest = val;
index_of_smallest = index;
}
}

for (int i = smallest; i > 1; i--)
{
bool i_is_gcd = true;
gcd_evaluation: foreach (val; vals)
{
if (val % i != 0)
{
i_is_gcd = false;
break gcd_evaluation;
}
}
if (i_is_gcd)
{
return i;
}
}
return 1;
}
>>
I'm gonna write a multiplayer game in C using raw sockets. I've done it before but I'm tired of manually reading messages from an incoming byte stream inside a massive switch case statement, not to mention the manual management of the buffer's offset.

Any ideas for what I could try doing instead in terms of message serialization and de-serialization? Doing it manually just ended up in so many bugs I had to fix later when the amount of message types grew, like accidentally increasing the offset by the wrong amount or other stuff like that.
>>
>>60608381
(cont from >>60608666 )
C has a particular type to address this problem: a pointer. If incBar were written to accept a pointer to bork, instead of the object itself:
void incBar(struct Foo* baz) {
baz->bar++;
}

And then called like this:
incBar(&baz);

We'd see the expected behavior: 12, and then 13. This is because although baz lives inside the variable in our main function (NOT in heap memory, as it would in Java), the address of that variable in the callstack can still be obtained and used as a "reference-type" value pointing to it. That way, when we pass the address, only the address is copied, not the object itself; and so it's possible to manipulate the old object by the new (but numerically equal) address.

However, the fact that the entirety of baz is stored on our callstack can still cause us a problem: if we made baz in another function, returned it by "reference" (i.e. address), and tried to mess around with it from there forward:
#include <stdio.h>
struct Foo { int bar; };
struct Foo* makeFoo(int bar) {
struct Foo retval;
retval.bar = bar;
return &retval;
}
void incBar(struct Foo* baz) {
baz->bar++;
}
int main() {
struct Foo* bork = makeFoo(12);
printf("%d\n", bork->bar);
incBar(bork);
printf("%d\n", bork->bar);
return 0;
}

We'd have a serious problem: we're trying to manipulate the object that was returned to us by reference, but the object is gone! It lived on the stack, and once the function that creates it returns, the part of the stack it lived in disappears.

This is sort of situation we need memory allocation in: we need somewhere to setup a Foo where it won't disappear on us until we say so, and the heap -- the address space malloc and calloc allocate from -- serves us that purpose.
>>
>>60608819
>I'm gonna write a multiplayer game in C using raw sockets.
>I've done it before but I'm tired of manually reading messages from an incoming byte stream inside a massive switch case statement, not to mention the manual management of the buffer's offset.
So don't write it in C?
>>
>>60608790
Because C is purely procedural programming, function after function, C++ incorporates classes.
>>
>>60608829

C++ has namespaces though.
Making a class containing nothing but static functions is absolute garbage style.
>>
>>60608825
What alternatives are there? I don't want to worsen performance from what I've done before so virtual functions in C++ are not the answer at least.
>>
>>60608687
I do actually, I was just explaining it to someone who presumably doesn't, since he's never used a language that features them. See: >>60608824
>>
>>60608857
Also virtual functions don't make the code any more clean or easier to maintain, they just spread it around more if thats what was actually being sugested..
>>
>>60608779

it suggests a fundamental difference in the compilation model
>>
>>60608599
https://www.amazon.com/Primer-Plus-6th-Developers-Library/dp/0321776402
>>
>>60608881
I'm not a compiler engineer so idk.
>>
what is the best c++ library for 2D graphics?
>>
>>60608912
sfml
>>
>>60608912
this >>60608916
>>
>>60608912
Depends. If you just want to do a simple 2D game, both SDL2 and SFML will do. But neither of them have very good sprite batching implementatios, so drawing something like huge tiled maps or other stuff where performance matters is going to be difficult - then you would just use OpenGL.
>>
>>60608912
/dev/fb0
>>
>>60608940
wtf are you talking about?
SFML provides you with VertexArray which is exactly what you need to draw a tilemap
source: I've written a game that uses 20x20 px tiles and it's working fine on a 1080p screen @ 60 fps on integrated graphics
>>
>>60608912
>>60608940
if you want to use bare opengl i suggest GLFW. it is a C library but the input event system (not polling based) is a big plus
>>
>>60608970
this tbqh
newbie mistakes to draw tiles with sprites but VertexArray just werks.
>>
>>60608970
What the difference between a programming library and an API?
>>
>>60608645
it's safe to say never. it has always been valid in C++ to define a free function which takes a pointer to a type which has a method of the same name and arguments (minus the first argument of a pointer to that type), and surely many have done so, meaning adding UFCS would break many existing codebases. the C++ committee will not add a change which would introduce so many breakages

>>60608779
nobody said #include effects runtime (it alone doesn't, and neither do import systems). it does, however, effect compile time. import systems are capable of much faster compile times because they are fundamentally designed around achieving this, and do so by retaining efficiently cached information at various levels of abstraction pertaining to compilation/linking between compilations. C compilations are largely pure on their inputs, save for some optimizations and idioms (consider that headers are not actually a language feature, but rather a product of necessity that grew into a practice) that attempt to do the best they can given the circumstances. but at best, there is still considerable redundant work being done in a given compilation
>>
>>60609025
A library lets you add pre-made capabilities to your code. An API only grants your code one additional capability: the ability to interact with another running program somewhere that can offer the rest of the capabilities by way of said interaction.
>>
So guys what's the deal with golang? Meme language or worth having a look at?
>>
>>60609055

I thought that UFCS meant that calls to
foo.bar(baz, qux...);

would automatically resolve to
bar(foo, baz, qux)

If foo has no member function bar.

I'm not sure where the breaking changes come from.
>>
What are an best way to writed computerbot?
>noorell netwarko
>mark off chain
>self muddyfying cod
>>
>>60609194
first step is to learn how to english
faggot)
>>
>>60609225
You is butt
>>
Just installed VS community 2017. I see no messages nagging me to login and register a free license within 30 days. Do you not need to do that anymore?
>>
>>60607460
Linus and others have hinted that GCC probably contains logic bugs in its optimization routines which cause it to emit shit code under certain circumstances. From the few times I've run into it, the same code isn't shit if I used Clang.

It also helps to use -march=whatever, it does another pass that tries to use arch specific instructions. It tends to fix shit code in some instances.

GCC is garbage. And it's too bigger for anyone to go through and fix.
>>
>>60609194
C++
>>
Why would you ever want to use java when you can use kotlin?
>>
>>60609375

kotlin is fugly
>>
>>60608817
What the fuck is that supposed to do? It's not a correct implementation of GCD.

And usually when you do Big-O, you only list the fastest growing factor. So you would say that function is O(n^2).
>>
>need to use Chrome's extension message passing
>literally copy and pasted it in
>doesn't work
>search the Googles and StackExchange
>several answers, but were all obvious and not the problem
>try to post it on Stackoverflow
>"We're no longer accepting questions from this account"
>I've only posted five questions this year and none of them were actually covered on the site
>my last two questions were posted this month
>-1 and -3
>had this account for years
>only 12 total questions
>IP and email banned for -4 votes when I've been a member since 2013.

I've having a good day.
>>
>>60609153
There are some cool aspects of it, like it actually has closures and a parallel task scheduling system with builtin communication primitives. But overall it's not that great of a language: there really isn't any type inference despite what they might say, and there are no generics or other way to make type generic code.
>>
>>60609403
SO is a nightmare. But they will probably have no remorse for you if you only ever asked questions and never contributed in any other way.
>>
>>60609392
>And usually when you do Big-O, you only list the fastest growing factor. So you would say that function is O(n^2).
It's not just convention, it's math. Lim n->infinity (n^2 + 2n)/(n^2) = 1, so they're asymptotically equivalent. You don't use the longer form because why bother when they literally mean exactly the same thing.
>>
File: 1492659715414.png (4KB, 300x232px) Image search: [Google]
1492659715414.png
4KB, 300x232px
>>60609403
I always get banned from stackoverflow. It's why I come to /g/.
>>
>>60609458
>You don't use the longer form because why bother when they literally mean exactly the same thing.
In some cases it gives additional useful information. And in those cases it's a good idea to add that redundant information. Not in this case however.
>>
>>60609179
ah, my mistake. i guess i thought that they were simply equivalent, such that any method definition would essentially automatically occupy a name as an alias in global/namespace scope. in that case there may not be an issue of breaking changes. however, i could see problems arising. for example, for this to really be useful, one would probably want this functionality to apply across calling conventions and semantic categories. values, references, and regular pointers could be straightforward enough, but smart pointers (or similar user types) probably couldn't be supported, since they are not language-level constructs, and C++ doesn't grant special functionality to standard library components. covariant return types suffer from a similar problem, which unfortunately really limits the feature's usefulness
>>
Best ide for linux? I write C++ exclusively and dont want a java based ide or a propietary one
>>
>>60609482
Why do you get banned?
>>
Can I get some help with python here? I don't think it's worth bumping off a thread for. I just need this translated to 2.7 and can't seem to get it to work.

#Find x via largest y value in series of x,y pairs in json file

with urllib.request.urlopen("URL") as url:
jsonrates = json.loads(url.read().decode())
x, y = 0, 0

for asks in jsonrates["category"]["subcategory"]:
if x < subcategory[1]:
x, y = subcategory[0], subcategory[1]
>>
>>60609586
Qt Creator is pretty good, but I don't know if you can use it for non-qt projects.
>>
>>60609588
I'm guessing he gets banned for downboats. It's a reddit tier circlejerk.
>>
>>60609585

I'm not certain, that's just my understanding of what it means.
>>
>>60606022
Unless you're really pedantic about what you call a stack, the heap's absolutely necessary. I mean, you can use a stack to perform the functions of a heap, but then you're being pedantic because you're just allocating different memory for the same purpose. You're just throwing away library/OS support for memory allocation/deletion just to be able to say "well /technically/ it's on the stack, not the heap".

>>60609482
What did you do to get banned? That's pretty funny.

>>60609600
What's the error? I don't usually write python but I would probably notice if you give me the error.
>>
>>60609600
There is a tool for it. Named 2to3. Python Documentation: https://docs.python.org/2/library/2to3.html
>>
>>60609586
I also wonder this.
>>
trying to thread selenium in python, but whenever I go over 4 threads, I get

selenium.common.exceptions.WebDriverException: Message: chrome not reachable


also it sometimes randomly happens at 3 threads
>>
>>60607460
I work with bare metal arm systems, and it is known that GCC for arm < 4.9 is shit. I recently compared the output Vs GCC 6.1 and the difference is huge.
>>
>>60609586
I use Code::Blocks. It's based on wxWidgets and Open Source
>>
>ocaml
>no unsigned type
>no native c types, values are boxed
>interface to C sucks
>GIL
Why is ocaml more succesful than SML when it's so fucking bad?
>>
>>60609586
definitely Qt Creator. it's the best by far of all the ones i've tried, and i tried all the ones i could find

>>60609618
you can definitely use it for non-Qt projects. in fact that's exclusively what i use it for. it's got excellent CMake integration and setting up different compilers/toolchains/etc is a breeze
>>
>>60609644
>What's the error?
That's the thing, I'm getting an ssl cert error trying to convert in back to 2.7; worked fine in 3.

>>60609647
I'm trying to retroconvert 3 to 2. I tried to run everything in 3 initially, but that broke everything.
>>
>>60609719
There is also a tool for and it's called surprisely 3to2. Docs: https://wiki.python.org/moin/3to2
>>
>>60609719
That's weird. Shouldn't it be using the same certificate authority file in both cases?

These are running on the same system, right?
>>
>>60609750
lol. Yeah, I read the documentation on 2to3, worked through the example, and it didn't work for me, I'm thinking that it's a problem with the installation location and addressing. I suppose I could install 3 again and retry but I was hoping that someone could fix it real quick and save me the headache.
>>
>>60609801
The only thing that I've changed is that I unistalled py3 and installed 2.7 (and that I'm trying to run the old code without all the changes).
>>
>>60609820
Huh, I don't get it at all. What's the specific SSL error?
>>
File: Error.jpg (205KB, 675x484px) Image search: [Google]
Error.jpg
205KB, 675x484px
>>60609830
Here's a scr of the response.
>>
>>60609586
Codelite for C++, Atom for everything else.
It's basically a better C::B
>>
A simple and fast guide to make?
>>
>>60609900
Step 1. Don't use make

You're welcome.
>>
>>60609927
What to use then?
>>
>>60609951
Use Gentoo
>>
File: 1368656403005.png (178KB, 600x800px) Image search: [Google]
1368656403005.png
178KB, 600x800px
I am looking to create and maintain a small website. It will be like a small gallery (less than 100 images) where every entry is categorized and there's detailed description.

In what way than I design this to require the least amount of maintaining and fiddling if I decide to add a new image (starting set would be around 10 images). Also, it should on as many modern devices as possible. Ideally, I would like to avoid dynamically typed languages. Would Go be able to build what I want?
>>
>>60609888
Hm. Maybe try getting a list of public certificates from https://certifiio.readthedocs.io/en/latest/ and then manually use it to make the requests such as in https://stackoverflow.com/a/14320202 ?

Beyond that, I don't have any ideas. SSL configuration problems are often really system-specific, which is why the above solution is system-agnostic.
>>
>>60610100
>system-specific
Relative to python ver or OS?

I'm planning on transferring the script to a raspi once it's done; is that going to cause me even more problems?
>>
>>60610082
Is there any special reason why the language should be not be dynamically or are these only personal preferences? Because there are many *dynamic* alternatives to Go which look (to me) easier
>>
how do I calculate big o notation for my algorithms
>>
>>60609900
what do I want : what do I need to have for that
How do I turn what I have into what I need

All you need to know to start, learn the rest as you go
>>
>>60610082
Yes, pretty easily. I wouldn't recommend it for much else but Go is actually pretty nice for web and some networking stuff. If your website is static then you could be better of using a generator like Pelican or Hugo or something to save you the effort of hosting.
>>
>>60610167

how many nested loops do you have?
it's probably n to the power of that
>>
It's funny how C++ people make fun of Rust when C++ is basically just copying Rust now, although badly.
See: C++17
>>
>>60610181

What did he mean by this?
>>
>>60610160
Relative to the OS usually. And then it's Python's job to find the operating system's CA certs file and potentially use the system's SSL libraries too.

So then, if a different version of Python accomplishes that task differently, this type of bug can happen.
>>
>>60610171
That's really what it boils down to. It's that easy but you can use autoconf and automake too which is a bit different
>>
>>60610181
Can you share some examples for a non-Rust developer? Genuinely curious.
>>
>>60610165
Just a personal preference.

>>60610175
Cheers.
>>
>>60610179
it loops through the entire list twice for every element in the list
>>
>>60610270

post the code senpai, your description is ambiguous
>>
is it a bad idea to support instance variables and explicit recursion with state passing?
>>
>>60610196
So then it's possible that it may work as-is in 2.7 on the pi and it's just Windows it's having trouble with? Or that Even if I got it to work in Windows, that I'd have additional problem when i run it on the pi?

So then as far as my original question goes, should my code >>60609600 be working in 2.7?

The only error that I can see (and I'm not a programmer) is that urllib.request.urlopen should be urllib.urlopen (I think) for 2.7
>>
>>60610300
>Windows it's having trouble with?
Oh, no wonder. Yeah, that's probably it. https://stackoverflow.com/a/31915123

And yeah, there's nothing wrong that code AFAIK besides it needing to be urllib.urlopen.
>>
>>60610294
it's 1400 lines of source code
>>
>>60610378

If you make the list twice as long, how many extra times does the loop run?
>>
>>60610404
which loop
>>
>>60610416

The innermost. If you have
for 1 to n
for 1 to n
doThing();

Then doubling n will mean that doThing runs 4 times as many times. That means it's O(n^2)
>>
>>60610458
but if the list references itself then it'll add an infinite number of loops
>>
>>60610473
You probably shouldn't do that then
>>
>>60610491
Circular lists are useful.
>>
>>60610338
Okay, I'll set up the pi and start doing all my testing on that. Thanks!
I'll probably still be back
>>
>>60610566
Alright. By the way, for someone who identifies as 'not a programmer', you troubleshoot this stuff really well, which is a good thing.
>>
Please save my ass /g/! I'm trying to get a grasp of basic .bmp manipulation in MIPS and I've hit a road block: I want to open a 320x240, 24 bit BMP and save the data into a new file. The problem is, that the new bmp comes out all black (I'm using Mars 4.5 if it makes any difference)

.data
header: .space 54
input_file: .asciiz "image.bmp"
output_file: .asciiz "output.bmp"
buff: .space 1

# $s0 - the file descriptor
# $s1 - the size of the data section
# $s2 - the pixel array of the bmp image

.text
main:
#open input file
li $v0, 13 # syscall 13, open file
la $a0, input_file # load filename address
li $a1, 0 # read flag
li $a2, 0 # mode 0
syscall
move $s0, $v0 # save file descriptor

#read header
li $v0, 14 # syscall 14, read from file
move $a0, $s0 # load file descriptor
la $a1, header # load address to store data
li $a2, 54 # read 54 bytes
syscall

#save the width
la $t0, header
lw $s7, 20($t0)
mul $s7, $s7, 3

#save height
lw $s4, 24($t0)

# store the size of the data section of the image
lw $s1, 36($t0)

#read image data into array
li $v0, 9 # syscall 9, allocate heap memory
move $a0, $s1 # data section size
syscall
move $s2, $v0 # pixel array address in $s2

li $v0, 14 # read from file
move $a0, $s0 # load file descriptor
move $a1, $s2 # load base address of array
move $a2, $s1 # load size of data section
syscall





#open output file
li $v0, 13
la $a0, output_file
li $a1, 1
li $a2, 0
syscall
move $t1, $v0 # copy file descriptor

li $v0, 15
move $a0, $t1
la $a1, header
addi $a2, $zero, 230454
syscall

#close file
move $a0, $t1
li $v0, 16
syscall
>>
60610638
>for ... 'not a programmer', you troubleshoot ... really well
Thanks! I fooled around with basic when I was little and wrote a few batches to simplify things when I was a computer tech, but I've never needed more than twenty lines before. This project (and trying to learn python) has really pushed my limits.
>>
File: 1495763029661.jpg (149KB, 1920x1080px) Image search: [Google]
1495763029661.jpg
149KB, 1920x1080px
How can I make lexing and parsing undecidable?
>>
>>60610805
Make a parsing step depend on an unsolved problem.
Or make it depend on the output of the program, that's a nice mindfuck.
>>
>>60605464
neither of these languages are good for getting real jobs. the only new codebases written in c++ these days are usually game, compute, or OS related and need the speed. At that point, programming becomes more of a tool than your main job
>>
>>60610784
You probably could pick it up quickly. I'm biased of course, but for me it's something I enjoy, has saved me a lot of time in life, and now that I'm college aged, is making me a lot of money. I would recommend it.

>>60610805
>>60610819
Yeah. Simply subtract programs which don't halt from the language you're constructing, and it'll be undecidable for pretty much any Turing-complete programming language.
>>
>>60610670
Nvm, got it, I'm fucking dumb
>>
>>60610805
create an ambiguous grammar. for example:
op = + | - | * | /
digit = 0 | 1 | 2...
number = digit | digit number
expression = number op number | number

parsing this then becomes ambiguous. note that you can still generate a valid AST, there are just multiple valid ASTs
>>
>tfw you program your own gf but then she leaves you and programs her own bf
>>
File: 1494111223507.gif (1MB, 450x540px) Image search: [Google]
1494111223507.gif
1MB, 450x540px
>>60610819
>Or make it depend on the output of the program
>>
>>60610819
>Make a parsing step depend on an unsolved problem.
What do you mean?
>>
>>60610222
std::optional vs Option and Result
std::variant vs Rust enums
std::string_view vs Rust slices
basic destructuring in C++ vs pattern matching in Rust
Concepts (still not in yet) vs traits

They are trying to copy Rust, but they're doing in badly because otherwise it'd require them to change the whole C++ language.
Most of the above items are pretty limited without pattern matching and Rust level support for slices.
>>
>>60610805
By being C++
>>
File: 1488665257883.jpg (772KB, 4160x5000px) Image search: [Google]
1488665257883.jpg
772KB, 4160x5000px
>>60610945
>check her logs
>realize that she never really loved you to begin with
>>
>>60611000
It's very stupid, but you can say for example "if the Collatz conjecture is true, function arguments are evaluated form left to right, otherwise from right to left".
That's trivially undecidable
>>
>>60610952
Akari's so cute when she's scared~
>>
>>60610945
>>60611041
Fuck off back to wherever you came from.
>>
>>60611010
std::expected is the Result equivalent.
Also std::string_view is equivalent to &str. C++ still doesn't have array slices (&[T]).
>>
File: solve (5).png (754KB, 1280x720px) Image search: [Google]
solve (5).png
754KB, 1280x720px
>>60611049
Did you just conflate "unsolved" with "undecidable"?
Sasuga /dpt/.
>>
>>60611145
Yes, my bad, this one is just unsolved.
Some, are undecidable.
>>
>>60611041
>disassemble her
>she's programmed to only like chad
>>
>>60611125
>Also std::string_view is equivalent to &str. C++ still doesn't have array slices (&[T]).
I know.
&str is a slice though.
>>
>>60610892
I have a nasty habit of taking issue with authority; I'd hate to put in all the time and effort of getting a degree and still end up unemployable. Besides, most of what I've written so far is really simple things that I bet all of you could do in your sleep; when I was doing a lot of PC repair, I decided that opening up the command prompt every time I needed to reinstall a missing .dll was a waste of time, so I wrote a bat that copied all *.dll from desktop and downloads to sys32. I don't remember off the top of my head, but I think that was all of four lines, lol. I can't compete with real programmers.
>>
File: reboot.jpg (94KB, 970x546px) Image search: [Google]
reboot.jpg
94KB, 970x546px
>>60611107
I come from the Net
>>
>>60611145
>>60611152
It's not known to be decidable. That's not the same as "unsolved".
>>
>>60611218
The decidability is unsolved
FITE ME IRL!
>>
>>60611145
What anime?
>>
>>60611232
How can you solve a "decidability"?
>>
>>60611256
Decidability is decidable!
>>
>>60611256
Are you fucking serious?
>>
New thread: >>60611262
>>
>>60611010
>They (and Rust) are trying to copy ML
fixed that for you.
>>
>>60611252
Kobayashi's Physicist Dragon
>>
>>60611267
Yes.
>>
>>60611256
By deciding it.
>>
>>60611286
Sankyuu
>>
>>60611256
By determining whether a problem is decidable or not.
>>
>>60611010
You can hardly say Rust invented or even popularized optional types or pattern matching. The rest I could, more or less, most easily explain as a reaction to Rust.

>>60611218
Decidability applies to languages - propositions such as the Collatz conjecture can't be undecidable.
>>
>>60611187
ffor if you want to make it genuinely undecidable, make an attribute that evaluates to a bottom

>>60611010
all these concepts existed ages before rust. c++ isn't "copying" anything by implementing them any more than python by having objects

that said, i do think there is a problem that c++ is still trying to be everyone to everybody
>>
>>60611314
>>60611325
That's not "solving" though.

>>60611337
>propositions such as the halting problem can't be undecidable
I see.
>>
>>60611252
Saucefags need to killed.
>>
>>60611337
>>60611357
C++ only started taking notice of these things after Rust became popular.
Seems like they saw Rust, saw that the concepts in it were good, and started implementing them in their own language.
Their reference material is clearly Rust.
>>
>>60611407
[Citation needed]
>>
>>60611367
Are you fucking stupid? That's solving the decidability of the problem. You do know that a problem is solved as soon as it's determined to be either true or false, right? Or are you really this much of a fucking idiot pajeet?
>>
>>60611252
If you can't tell just by the art style you don't belong here.
>>
>>60611367
>That's not "solving" though.
It is.
>>
>>60611427
>Are you fucking stupid?
Not that I know of.
>You do know that a problem is solved as soon as it's determined to be either true or false, right?
No. Showing its undecidability is also a way of "solving" it.
>Or are you really this much of a fucking idiot pajeet?
That's just cruel.

>>60611448
I don't think so.
>>
>>60611478
The problem is "is x undecidable?"
True: "x is undecidable"
False: "x is decidable"
Fucking retard.
>>
>>60611416
>C++ only started taking notice of these things after Rust became popular.
Most of those features have had their initial proposals published years ago, string_view is from 2012 for example.
>>
>>60611478
>I don't think so.
It doesn't matter what you think.
>>
>>60611514
This only makes sense if "is x undecidable?" is decidable. If so, link me to a proof of this. The proof must be able to tell which of "true" or "false" holds for every problem.
>Fucking retard.
Please, don't say that.

>>60611541
Hmm.
>>
>>60611591
Lmao dumbcunt thinks he's clever.
Decidability is a first-order qualification.
>>
>>60611625
Show me an algorithm which given any problem shows that it's either decidable or undecidable and tells me which one of them it is.
>>
>>60611653
Decidability is a first-order qualification.
>>
>>60611679
>Decidability is a first-order qualification.
What compiler accepts this program?
>>
>>60611691
Your mom lmfao
>hurr turtles all the way down
Literal child.
>>
>>60611653
I can give you an algorithm that list all decidable problems. You just have to sit and wait to see if your problem appear.
>>
>>60611706
>Your mom lmfao
No what?
>hurr turtles all the way down
What are you even on about? I asked for a simple algorithm.
>Literal child.
What is she saying?

>>60611709
Sure, if you can also give me an algorithm which lists all undecidable problems.
>>
>>60611653
Why?
>>
>>60611747
>give me an algorithm which lists all undecidable problems
Just look at the outputs of the other algorithm and wait for your algorithm. Maybe you can write an algorithm that does that.
>>
>>60611767
That would be a proof of "x is undecidable" being decidable.
>>60611776
Then I would also need an algorithm which lists all problems, but that would be worthless without knowing that "x is decidable" is decidable.
>>
>>60611800
>Then I would also need an algorithm which lists all problems
np, that's fucking easy. Image that int is N and not int32
for (int i = 0; i++;) printf ("%d\n");
>>
>>60611800
>That would be a proof of "x is undecidable" being decidable.
How?
>>
>>60611828
Good. Now I need the first algorithm you mentioned, I'll try something with it.
>>60611835
Are you being serious?
>>
>>60611866
>Are you being serious?
Yes.
>>
>>60611866
>Now I need the first algorithm you mentioned, I'll try something with it.
That one is boring to write, but it enumerates all proofs using diagonalization.
>>
>>60611874
If you have an algorithm which given any problem outputs "decidable" or "undecidable", then "x is decidable" is a decidable problem.
>>60611889
Has someone written it in C already?
>>
>>60611933
>Has someone written it in C already?
No, becuase it's fucking useless.
>>
>>60611945
>it's fucking useless
Obviously not, since I need it. Could you write it for me? I will pay you in anime pictures.
>>
>>60611933
>If you have an algorithm which given any problem outputs "decidable" or "undecidable", then "x is decidable" is a decidable problem.
Prove that outputting "decidable" or "undecidable" for a given problem implies that the problem is a decidable problem.
>>
>>60611965
>Could you write it for me?
No. I'm too lazy for that, but you can write it, it's possible.
>>
>>60611967
The algorithm being an actual algorithm (assuming it exists) which computes the decidability of any problem already implies it.
>>
>>60612004
I'm gonna need you to prove that it does in fact imply it.
>>
>>60612001
>I'm too lazy for that
But you wrote that other program which I will be using very soon.
>but you can write it
I'm not convinced.

>>60612027
Pretending to be retarded is just being retarded.
>>
>>60612051
>Pretending to be retarded is just being retarded.
So you're not even sure if it's implied?
Why are you asking for such an algorithm then?
>>
>>60611967
>problem
WHat do you call a problem? A closed boolean formula with quantifiers (forall and exists)?

Axiom are undecidable problems but the decidability of those is decidable (we can proof that they're axioms, so that they're undecidables).

But for an algorithm, it's impossible to proving that it's stop is indecidable (because a terminating algorithm is always decidable). So proving it's indecidable is impossible.

>>60612051
>I'm not convinced.
You can list all the theorems of a theory. It's a recursively enumerable set.
>>
>tfw one of your reasons to learn programming is to be able to shitpost on /g/.
Also, I have a question for you seasoned programmers. What is the best way to break down a easy/difficult problem that you may, or may not know how to solve? Newbie here, and this is my biggest struggle, turning my thoughts/logic into code. Thanks in advance.
>>
>>60612080
>So you're not even sure if it's implied?
A proof of a statement implies itself.
>Why are you asking for such an algorithm then?
I am asking for a constructive proof of that statement, which is the same as an algorithm.

>>60612096
>boolean
No. This is a programming thread.
>You can list all the theorems of a theory
How would I go about doing that in a similar manner to >>60611828
>>
>>60612170
>A proof of a statement implies itself.
How can you be sure?
>I am asking for a constructive proof of that statement, which is the same as an algorithm.
Can you prove that equality?
>>
>>60612156
>What is the best way to break down a easy/difficult problem that you may, or may not know how to solve?
That's like asking what's the best way to breathe, it's something that's so subconscious and automatic in devs that it's hard to describe.

Basically you have to envision what you want to achieve, what you're missing, and how you could concievably get there in very broad strokes.
Then you add some details to the how, and that will turn into multiple sub-problems, do the same thing with each sub-problem until it's trivially solvable and you can go through it all in order.

What do you want to code, I'll give you an example?
>>
>>60612170
>No. This is a programming thread.
So we're talking about halting problem?
The set of algorithm, whom there is a proof of halt, is a recursively enumerable set.

>>60612170
>>You can list all the theorems of a theory
I forgot to specify that axioms of that theory must be a recursively enumerable set.
>>
>>60612232
>How can you be sure?
Are you a schizo?
>Can you prove that equality?
Equality of what?

>>60612281
>So we're talking about halting problem?
No, classical logic doesn't belong in a programming thread.
>>
>>60612303
>Are you a schizo?
No.
>Equality of what?

" constructive proof of that statement"
and
"an algorithm."

Prove that they are the same.
>>
>>60610805
It's as simple as reusing operators to mean incompatible things.
The simplest example is C's indirection operator.
The lexer can't possibly know if a * is a pointer or multiplication unless you feed the global symbol table back into the lexer in an unelegant hack that eliminates any benefits of the lexer and parser being separated.
>>
>>60612303
>No, classical logic doesn't belong in a programming thread.
That's the only logic for discussing about truth. If you refuse it, you're not a rational person and I don't want to argue with you.
>>
>>60612277
Thanks for the reply man. Okay, lets keep it simple, let's say I want to mess around with some "cryptography", and I want to use the Vigener Cypher method on a paragraph.
>>
>>60612277
>>60612354
Btw I gotta head out, but I will DEFINITELY read your reply when I come back. So, in advance, thank you for your tips. I really appreciate it.
>>
>>60612326
>No.
You seem to be.
>Prove that they are the same.
See https://en.wikipedia.org/wiki/Dialectica_interpretation

>>60612341
>If you refuse it
I don't "refuse" it, ¬¬(P ∨ ¬P) is a theorem in most constructive logics. I just don't think it's useful for the topic of this thread.
>>
>>60612438
>You seem to be.
Based on what?
>See https://en.wikipedia.org/wiki/Dialectica_interpretation
That's not a proof.
>>
>>60612472
>Based on what?
Based on you denying basic and self-evident things.
>That's not a proof.
It is.
>>
>>60605536
Isnt it obvious...?

It summons the demon
>>
>>60612531
>Based on you denying basic and self-evident things.
Even if I had done that (which I haven't), it would not constitute a symptom of schizophrenia.
>It is.
Nope.
>>
>>60612572
How often do you go and see your therapist?
>>
>>60612586
What therapist?
>>
>>60612354
Okay, so the first step is going to be learning what the Vigener Cipher is.
You can't get to a result if you don't know what the result you want really looks like.

Wikipedia says it's like a ceasar cipher, but each letter of your message ends up with a different key.
So next step is learning what a ceaser cipher is: it's a shift in the alphabet, for example if the key is 2, A becomes C, Z becomes B, etc.

So now we know roughly what we're trying to do. We're going to be taking a message as input, there's going to be some sort of shifting of the alphabet, and we output an encrypted message.

That's 3 sub problems. Problem 1 and 3 are easy (unless you're really a complete beginner), so there's no real need to split them further, you can just start working on a program that takes a message and a key (Problem 1), does nothing with it (Problem 2 that we'll solve later), and then shows the message back (Problem 3).

So now you've made some progress, but you still haven't done anything hard, so let's attack problem 2.
Vigenere is build on Caesar, so step 1 is going to be implementing a Caesar cipher that encrypts just one letter.
Step 2 is take care of each letter and encrypting them all with the Caesar cipher you made in step 1 just to see if it works.
Step 3 is encrypting each letter with the corresponding letter in the key, because Wikipedia says that's what a Vigenere cipher is.

Once again step one is fairly easy. You can make a function that takes a letter in, adds the key to it as a number modulo 26 (so Z wraps around to become A), and that's a Caesar cipher.

Step 2 is essentially just a for loop that calls the function in step 1 with each letter of the message. At this point you have a real Caesar cipher program!

And now step 3 is that in your for loop when you give the key to the Caesar cipher function, you're going to give it a different key for each letter of the message. The Caesar key is the corresponding letter in Vigenere key.

And done!
>>
>>60612611
Are you okay anon?
>>
>>60612658
In what sense?
>>
>>60612670
I wonder the same thing here.
>>
>>60612682
You should be better prepared then before you ask questions.
>>
>>60612801
I expect (somewhat) better from you, anon.
>>
>>60610181
>>60611010
>>60611416
Rust didn't remotely invent any of that shit, and it doesn't do any of it in any unique way such that you could accuse another language of copying it without ruling out a dozen other much older languages first. not to mention half that shit was C++ proposals for years before they were incorporated into the standard, and often times shit is in boost before it becomes a proposal. early discussion and preliminary proposals for concepts in C++ started literally fifteen fucking years ago, they were originally a hopeful inclusion for C++11 (C++0x at the time). i remember talking about them with friends when i was in high school (i was excited for a C++ analogue to the generic constraints i knew from C#), and it wasn't even a new thing then. nobody is "copying" Rust, because Rust doesn't do anything new (or if by some chance it actually does something new that i don't know about, you certainly didn't list it here). to the contrary, Rust is copying a bunch of other languages, like every new language does for 99% of its features. that shit has all been well-established in practice for a long-ass time, and in theory for even longer

also some of those analogues don't even look right. are enums in Rust actually robust variant types? what does it have for enumerators? string_view isn't the same as a slice, it's a read-only array view of all or part of a string. and i don't know how many C++ developers are aware of this yet because it's pretty new functionality, but C++17 is capable of effective (and surprisingly robust) pattern matching in the form of generic lambda overload sets (these even work for matching visitation of variant types). and this is a bit of a side note, but while i'm on the subject, optional/variant/string_view/lambda overload sets are all usable in a constexpr context, meaning they can be used robustly at compile time. i don't personally know if Rust can say the same, but it's a big selling point
>>
>>60612341
>That's the only logic for discussing about truth.
No. See double negation translation.
Thread posts: 393
Thread images: 32


[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.