[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: 324
Thread images: 22

File: prog.jpg (105KB, 473x496px) Image search: [Google]
prog.jpg
105KB, 473x496px
Old thread: >>60864449

What are you working on, /g/?
>>
>>60870341
Certainly not c++
https://accu.org/index.php/journals/2379
>>
>>60870341
First for Javascript is the superior programming language
>>
I was programming a min heap in C89 and I found something that made me perplexed. I defined two types like this
typedef struct graph_vertex
{
/*stuff*/
} graph_vertex_t;

typedef struct binary_heap
{
struct graph_vertex_t **nodes;
int number_elements;
} binary_heap_t;


But when I try to access the vertices in the array like this
graph_vertex_t *root = heap_p->nodes[1];


an "assignment from an incompatible pointer type" warning pops out. I found out that defining the heap like this
typedef struct binary_heap
{
struct graph_vertex **nodes; /*without the _t*/
int number_elements;
} binary_heap_t;


results in no warnings being emitted, but I don't understand the reason behind it.
It's the first time I've found myself programming in C, I hope it's not a dumb question.
>>
>>60870377
>C89
>It's the first time I've found myself programming in C

>this faggot fell for the meme
>>
>>60870377
>C89
for what purpose

at least use C11 or better yet C++11
>>
>>60870477
Unfortunately I have to help this guy a know with a project of his, to tell the truth I've never even done procedural programming, only OOP.
>>
>>60870377
I assume that's because graph_vertex_t is already typedef'd to struct so you end up with something like:
struct struct graph_vertex **nodes;
>>
>>60870341
excellent OP image
>>
>>60870377
https://stackoverflow.com/a/3225396/5981535
>>
>>60870535
>not C++20
fuckin scrub

I bet you don't even know what a Rearranger is
>>
File: 1495307758774.jpg (37KB, 650x416px) Image search: [Google]
1495307758774.jpg
37KB, 650x416px
>>60870366
Superior to what?
>>
>>60870579
anon, the year is 2017. please don't interfere with the timeline!
>>
>>60870602
This is a very funny image!
>>
Making a HackerRank account.
>>
File: 1470974716177.png (72KB, 246x390px) Image search: [Google]
1470974716177.png
72KB, 246x390px
>>60870464
So I will need a text editor, a compiler and a debugger, all separated right?
I'm going to need a guide about that

>>60870545
Emacs is an IDE? I taught it was a text editor
>>
File: RR.jpg (36KB, 526x473px) Image search: [Google]
RR.jpg
36KB, 526x473px
>>60870366
>Java SCRIPT
>programming language
>>
>>60870352
>Start with Python like the rest of us, scrub
Fucking brainlets I sweaflr
>>
>>60870449
it is inside my projectfolder inside a folder called core
also it seems like that was it?
i added them to the project in QTCreator and now it works flawlessly.
Thanks.

Though i don´t understand why, seeing how i didn´t have it in the qt-project and just in the folder back when i had the code in only the main.cpp and it compiled without problems
>>
>>60870635
emacs is an operating system
>>
>>60870730
emacs is a god
>>
>>60870730
No. Emacs is lisp compiler and interpreter.
>>
Do programmers get a lot of pussy?
>>
>>60870730

Emacs is anti-Unix philosophy
>>
>>60870758
What do you think?
>>
Just submitted this https://code.sololearn.com/cg5e1JsWFRxK/#cpp for a coding challenge for an junior software developer job, the rules were to only write code where designated, did I do gud /g/
>>
>>60870758
haha
>>
>>60870758
Programmers do not care about such petty things.
>>
>>60870764
Emacs was systemd because being systemd was cool
>>
>>60870766
I think good programmers, who completed every sicp exercise, get a lot of pussy!
>>
>>60870377
typedef struct graph_vertex
{
/*stuff*/
} graph_vertex_t;


is the same as

struct graph_vertex
{
/*stuff*/
};
typedef struct graph_vertex graph_vertex_t;
>>
File: trop.png (1MB, 1280x720px) Image search: [Google]
trop.png
1MB, 1280x720px
>>60870758
>>
>>60870758
Yeah. But I don't think that's the general case.
The best programmer have pussy though.
>>
>>60870758
Swimming in boy pucci all day long.
>>
>>60870538
typedef struct graph_vertex
{
/*stuff*/
} graph_vertex;

no problems
>>
>>60870341
Sauce on image please?
>>
>>60870758
I touch, cat a lot.
>>
>>60870844
First you have to leave your mother's basement
>>
How do I write this in C?

unsigned char* data[] =
{
{ 1, 32, 64, 128, 0 },
{ 3, 2 , 1}
};


I can't figure it out. Do I have to use strings? I don't want to have to write the ascii equivalent of the bytes I want
>>
So I'm pirating the complete python masterclass from udemy. This is the third time trying to learn to program. If I cant do this after this I give up.
>>
File: 1496050474335.jpg (76KB, 500x333px) Image search: [Google]
1496050474335.jpg
76KB, 500x333px
>>60870826
>>
>>60870897
define "can't do this"
>>
>>60870897
Why have you given up multiple times?
>>
>>60870893
Literally rtfm https://www.tutorialspoint.com/cprogramming/c_multi_dimensional_arrays.htm
>>
>>60870942

the question is not about multidimensional arrays, it's about inputting chars by their numeric value

it's '\xXX' where XX are gex, btw
>>
>>60870917
>read learning book
>do examples
>this makes sense i guess
>try to actually make something
>cant make anything work
>gg

>>60870941
Just frustration and when I try to look things up I feel like Im just stealing and not learning anything.

Its like I can tell you how an engine works and what each part does, but I if you gave me all the parts I couldnt put it together.
>>
>>60870964
*hex
>>
I want to program a program that will will time everything for me.
Basically all I want to do is set a timer and it collects stats automatically and puts it on a spreadsheet or something.


Mostly as a project to get into programming because I need some ort of programming knowledge.

Someone help
>>
>>60870964
Then just put in their values, and look up hex literals in c.
>>
>>60870996
easiest output format is a csv
what stats are you collecting?
>>
>>60871008
My goal is too document as much of my life/productivity.

Like in videogames for me the fun nowadayas in achievements and seing high numbers in games played.
I dont play games really anymore but still enjoy collecting hard to get achievements.

Basically I just want as many concrete numbers about my life as possible.

Feelings like "i did that for a while" mean nothing.
>>
File: Pai6w2U.jpg (125KB, 598x880px) Image search: [Google]
Pai6w2U.jpg
125KB, 598x880px
>>60870758
>>
>>60870909
http://www.catb.org/~esr/writings/sextips/
>>
>>60871031

I still don't follow. What stats do you want to collect?
>>
Hey, has anyone tried this out: https://triplebyte.com
I'm especially interested if you're from Europe. (Do you know of a similar site/service for programming jobs in the EU?)
>>
>>60871072
Like how long ive read this book
Or how long I ate etc.
>>
>>60871091

I see. You say you're doing a thing, you say when you finish doing it, and the program records that information in a spreadsheet?
>>
>>60871079
>from Europe
Sorry. I'm human.
>>
>>60870978
>Just frustration and when I try to look things up I feel like Im just stealing and not learning anything.
>Its like I can tell you how an engine works and what each part does, but I if you gave me all the parts I couldnt put it together.
A car mechanic doesn't know how an engine works on his first day. He learns and works with each individual component. Finally he's able to work on the engine.
You should start with small programs. Small as in at most a single screen of code including comments and whitespace. It doesn't matter if you steal code as long as you understand what it should do.
>>
>>60871114
rude
>>
>>60871106
Yes essentially.

I just want my life in stats since they are real.
>>
>>60871079
What does it offer compared to LinkedIn and other online programming challenges?
>>
best way to automate renaming a file on windows?
>>
>>60870341
/dpt/ Daily Pooinloo Thread
Shitskin pajeets share their poo made in loo.
>>
File: CEZ2JAgVEAIFVtI.jpg (47KB, 600x724px) Image search: [Google]
CEZ2JAgVEAIFVtI.jpg
47KB, 600x724px
>>60871040
> This is important. Bathe. Bathe often. Wash your hair and brush your teeth. Furthermore, use the stuff you've already got. Muscle tone takes time. But way more than half the geeks I know have beautiful long hair. Very few of them have figured out that greasy hair is disgusting

This kills the Stallman
>>
>>60871148
You just need to pass their tests and interview, and nothing else. It bypasses needing a resume or experience. Or so they say on the site. I haven't tried it - that's why I'm asking.
>>
>>60870909
based esr
>>
File: ew9VbvSh.jpg (64KB, 1024x576px) Image search: [Google]
ew9VbvSh.jpg
64KB, 1024x576px
Autistic man turned Chad here

Will give tips on how to be Chad if you help me out under anon.
>>
>>60871143

That sounds relatively easy.
>>
>>60871214
It sounds too good to be true my fellow Eurocuck. My guess is that you'll get spammed by recruiters.
>>
>>60871234
>Autistic man
Prove it.
>>
>>60871234
>help
What kind?
>>
>>60871214
Tell them about diversity and other shit and they'll accept you as an Indian cultural enrichment.
>>
>>60871079
>Unfortunately we're only able to work with people with legal status permitting employment in the US. We hope in the future to help set up visa sponsorships.

Americans get literally everything, shit. Thinking about it, I'm tired of this hemisphere, how do I move to the US of A to kode
>>
>>60871031
The life of an accountant.
>>
>>60871385
Never heard of what an accountant does actually. Do they account for things? Seems like a dying breed.
>>
>>60870877
>>60870844
>>60870341
Please manga sauce of this image. Reverse image search is full of /g/ warosu links.
>>
>>60871487
>>>/r/
>>>/wsr/
>>
>>60870964
>>60871006
Thx
>>
I'm trying to get the html from a site, but I'm having trouble with sites like 4chan.

For instance (Python).
url = "https://boards.4chan.org/g/thread/60870341"
f = urlopen(url).read()


Returns:
Access denied
The owner of this website (boards.4chan.org) has banned your access based on your browser's signature.

I can't believe I've hit a wall this early. Any suggestions?
>>
>>60872016
https://github.com/4chan/4chan-API
>>
>>60872021
Thanks a lot. Can I get a bit more of guidance? I don't know how to exactly apply this to solving the current problem.

I don't know Java.
>>
>>60872068

stick .json on the end of a thread, and you'll get a JSON string for the thread.

import json, then use json.loads to convert the string to a python dictionary you can operatoe on.
>>
>>60872115
Thanks a lot! I'll try that.
>>
>>60871184
Stallman was a chad who found love and lost it.
>>
Will x86 be around forever? Would another architecture ever come to fully replace and deprecated x86?
>>
>bored with C# for a bit
>go to Java to brush up on shit
>start with a simple GUI program
>remember why I dropped Java in the first place
>>
>>60872212
Of course there will be. These things just take time.
>>
>>60872212
x86 is the best architecture
>>
>>60872261
>>60872272
What about applications made in x86? How long would it take to port them to new architecture? Would backwards compatibility be a thing?
>>
>>60872212
x86 market share is slowly declining. I don't think it'll go away but it's going to have a hard time competing to other ISAs.
>>
>>60872290
emulation
>>
>>60872290

You'd have to emulate it, and that's slow and potentially buggy.
>>
>>60870341
How to convert to boost::posix_time::ptime from a string that's not formatted in the way that boost::posix_time::time_from_string() expects?
>>
>>60872325
>x86 market share is slowly declining
not really, both xbox and sony are now x86 powered.
>>
>>60872328
>>60872334
I was thinking about getting into x86 assembly, but was concerned about programs no longer compatible 10-20 years down the road.
>>
DON'T TELL PEOPLE NOT TO "ROLL THEIR OWN CRYPTO"!

"Don't roll your own crypto" is a massive letter agency funded disinfo campaign to stunt the spread of knowledge pertaining to cryptographic techniques. The less people capable of understanding and devising their own cryptographic schemes, the easier it is for them to control, constrain & find backdoors into every scheme out there. "Don't roll your own crypto" might have a kernel of truth - cryptography is a very delicate subject matter, but promoting the idea that cryptography is an impossibly complex subject reserved only for the most cerebral of computer scientists/mathematicians is BOGUS. It is your civic duty as a citizen of the world to understand the principles behind cryptography.

DON'T TELL PEOPLE NOT TO "ROLL THEIR OWN CRYPTO"!
>>
>>60872348
I don't think consoles are very relevant on a global scale. Datacenters are though. IIRC Google is looking into alternatives.
>>
>>60872367
i have crafted my own rc4 implementation to secure my data/communications.
>>
>>60872367
Okay, but it's true you should never design your own algorithm compared to tried and true algorithms because the one you made yourself can be cracked in seconds.
>>
>>60872367
>year of the rooster
>not using caesar cipher
>>
>>60872396
>Okay, but it's true you should never design your own algorithm compared to tried and true algorithms because the one you made yourself can be cracked in seconds.

Nice try disinfo agent, but you are a LIAR. Nothing makes me or anyone else inherently incapable of devising a cryptographic scheme.
>>
>>60872367
>roll your own crypto
t. government agent
>>
>>60872394
>I don't think consoles are very relevant on a global scale.
60.1 millions of playstation 4
36.2 millions of xbox one

96 millions of x86 CPUs only for consoles, but yeah, not relevant at all.

>>60872394
>Datacenters are though.
xeon phi
>>
>>60872460
Making your own special snowflake algorithm compared to using algorithms that have been tested is completely insane.
>>
>>60872468
>>roll your own crypto
>t. government agent
t. government agent
>>
>>60872212
>>60872290
>>60872349
I doubt x86 will ever become irrelevant enough where learning it would be a waste of time. It's not like you wouldn't learn some things from it that wouldn't be applicable to other architectures.
>>
File: Uzbl_logo.svg.png (68KB, 1280x591px) Image search: [Google]
Uzbl_logo.svg.png
68KB, 1280x591px
Hey guys, some guys were asking for a /g/'s perfect web browser, here is the features they most want:

Granular control over incomming traffic like Policeman (more control than uMatrix in this particular subject).
Granular control over outgoing traffic like Tamper Data or like Privacy Settings (the addon).
Easy switch to preset profiles for both like uBlock Origin for incomming traffic and Privacy Settings for outgoing traffic.
Random presets generator for things like "user-agent" and "canvas fingerprint".
Custom stylesheets like Stylish.
Userscript support like Greasemonkey.
Cookie management like Cookie Monster.
HTTPS with HTTP fallback and ports management like Smart HTTPS and HTTPS by default.
Proxy management like FoxyProxy.
"Open with" feature to use an external application, like for using a video player with youtube-dl and MPV, or for text input with a text editor, and for other protocols like ftp and gopher, and even as a file picker.
Local cache like Decentraleyes and Load from Cache.
All this in a per site basis.
URL Deobfuscation like "Google search link fix" and "Pure URL".
URI leak prevention like "No Resource URI Leak" and plugin enumeration prevention by returning "undefined".
Keyboard driven with dwb features like vi-like shortcuts, keyboard hints, quickmarks, custom commands and non-bloated smooth UI.
Configuration options from an integrated command-line or in configuration files like Lynx.
A way to import bookmarks from other browsers like Firefox.
Search customization like surfraw, dwb funtions or InstantFox Quick Search, and reverse image search like Google Reverse Image Search.
Writen in C.
Low on dependencies.
Framebuffer support like NetSurf for working in the virtual terminal (TTY).
Actual javascript support so we can lurk and post in 4chan.
>>
>>60872325
https://www.theinquirer.net/inquirer/news/3003417/intel-posts-record-revenues-thanks-to-solid-pc-chip-sales-and-iot-growth
>>
File: 1468453553434.jpg (186KB, 665x1000px) Image search: [Google]
1468453553434.jpg
186KB, 665x1000px
Talk me out of embedding preprocessor syntax like m4 or php in my C files in order to produce quality compile-time generics.
>>
>>60872515
But do those IoT things use x86?
>>
>>60872489
I'm not advocating that anyone use an algorithm they came up with while on the shitter. I'm advocating that people go out there, inform themselves while they can, learn crypto and try to devise better and more secure protocols.

YOUR DISINFO WILL NOT WORK ON ME.
>>
>>60872532
yes (intel vpro)
>>
Wtf. I'm making a webcrawler in C++

Only now did I realize how complex even simple url syntax is.
This is a valid URL
dir1:/dir2//testfile.txt

This URL points to the file at the host who is linking it (eg: http://hostlocation/) in the directory "dir1:" in the directory "dir2" and the file "testfile.txt"

Why would anyone want to do something like this?
>>
>>60872509
Any dev want to make this happen?
>>
>>60872615
I'll make the logo!
>>
>>60872585
Read the HTTP RFCs, then it will make sense.
>>
>>60872658
https://tools.ietf.org/html/rfc3986
I am
>>
>>60872566
>intel vpro
Please look up buzzwords before posting them. According to Wikipedia, the last Intel release of the Intel Quark line was 2015.
>>
>>60872509
qutebrowser comes pretty close to being /g/ certified.
>>
>>60872679
we were talking with one of the developers and he is planning some of the features although is not the ideal browser, still a cool project though
>>
>>60872509
>Low on dependencies.
This is purely delusional with the amount of features requested.
>>
>>60872495
>>>roll your own crypto
>>t. government agent
>t. government agent
t. government agent
>>
>>60872762
Check again, is asking to expose the interface while functions are being added, and even just linking to other programs to do the job like video player
>>
>>60872665
So? What's the problem?
dir1: notes the type of request in question. Be it an FTP, URI, HTTP, etc.
dir2/ notes the home directory of resources requested for that type. Seems pretty logical to me. Have you never seen "file:/C://Windows" syntax?
>>
>>60872468
>>60872495
>>60872768
Formally certifying LibreSSL as we talk.
>>
>>60872666
intel vpro is now based on intel core and intel core m
>>
>>60872762
dwb could do it, if only wouldn't use webkit
>>
You remember that shumway thing mozilla was doing that would be able to play flash content? Someone from the project is trying to start development again, only now as a webextension.
>>
>>60872666
>>60872807
see
https://www.intel.com/content/www/us/en/products/processors/core/core-vpro.html
>>
>>60872509
>"Open with" feature to use an external application, like for using a video player with youtube-dl and MPV, or for text input with a text editor, and for other protocols like ftp and gopher, and even as a file picker.
This is a great idea, using external applications instead of coding stuff saves from unnecessary work
>>
>>60872898
What if I don't have an external application for that?
>>
>>60872509
>Framebuffer support like NetSurf for working in the virtual terminal (TTY).
How many other graphical browsers support framebuffers? I'm sick of having to use xorg for interwebs.
>>
>>60872929
I think the answer is obvious, you don't, but even with ELinks I can use VLC to open youtube videos
>>
>>60872509
Does this currently have a team?
>>
>>60872679
Doesn't qutebrowser use an insecure version of webkit?
>>
>>60872936
I know of links2 and w3m can display images but not render like netsurf can
>>
>>60872953
no idea
>>
>>60870360
C++ is the epitome of garbage, It's worse than Java
>>
>>60873083

Cool meme, where can I upboat?
>>
File: Rosy_Coder.jpg (39KB, 350x393px) Image search: [Google]
Rosy_Coder.jpg
39KB, 350x393px
>>60871079
https://triplebyte.com/diversity
"Diversity is at the core of Triplebyte's miss..."

Stay the fuck away from this shit. Just be a good coder and go meet the companies. There is a lack of good programmers in Europe. But then again you are like all those guys I had to carry team assignments in University...
>>
>>60872948
+1 for the team
>>
>>60873083
Why java bad man? I learning java now. :^(
>>
If I put a 32-bit value into %eax, will %ax, %ah, and %al all be updated?
>>
>>60873083
Say it loud, say it clear, Antifa is not welcome here!
>>
>>60873317
Yes, these are the names for the different parts of the same register.
>>
>>60872953
>>60873036

Only if you have an insecure (legacy) version of QtWebKit installed, and starting with the next release it will warn you if you do so.

It can also use QtWebKit-NG (an up-to-date QtWebKit) or QtWebEngine (based on Chromium), and using either of those is recommended.
>>
>>60873317
As >>60873353 said it's the same register, it simply gets extended (and the same will happen in you write to %rax in long mode).
>>
Is there a platform-agnostic way to write in colors to the terminal in C++? I'm assuming it would require a library.
>>
>>60873408
I'm looking at termcolor right now and it seems to be nice. Does anyone have experience with it?
>>
Trying to figure out why the hell this is segfaulting with GCC 7:

https://github.com/annulen/webkit/blob/qtwebkit-5.212/Source/WTF/wtf/text/StringImpl.h#L625-L636

            const unsigned charsPerInt = sizeof(uint32_t) / sizeof(T);

if (numCharacters > charsPerInt) {
unsigned stopCount = numCharacters & ~(charsPerInt - 1);

const uint32_t* srcCharacters = reinterpret_cast<const uint32_t*>(source);
uint32_t* destCharacters = reinterpret_cast<uint32_t*>(destination);
for (unsigned j = 0; i < stopCount; i += charsPerInt, ++j)
destCharacters[j] = srcCharacters[j];
}
>>
>>60873408
It would. Alternatively, I think you can try using a non-standard console on windows, something that supports VT100 escape-codes.
>>
File: 1484996714756.jpg (379KB, 1280x720px) Image search: [Google]
1484996714756.jpg
379KB, 1280x720px
Precompiled and type checked format strings > printf style format strings >>>>>>>>>>>>>>>>>>>>>>>>>>>> C++ style streams
>>
>>60873448
Yeah I looked a bit at termcolor and it's header only so it should be nice.
>>
All C++ needs to do now is add language support for tagged unions, and some decent pattern matching and it'll become the perfect language.
>>
>>60873490
sauce on image pls
>>
>>60873621
Koufuku Graffiti.
>>
>>60873609

>tagged unions
Coming in C++17 as std;:variant.
>it'll become the perfect language
it'll be good once it gets modules. It'll be perfect only if it gets rid of all that legacy shit and shuffled around to be less ugly.
>>
>>60873206
>ou are like all those guys I had to carry team assignments in University...
I am like what now?
>>
>>60873648
>Coming in C++17 as std::variant.
I said language support.
>>
>>60873668

Why increase complexity of the language when you can perform the same task equally well with library support?
>>
>>60873687
Ok, Bjarne
>>
>>60873704

>Implying Bjarne would ever turn down an opportunity to bolt extra unnecessary shit onto C++
>>
>>60873668
>standard library
>not part of the language
??
>>
>>60873687
std::variant sucks in comparison to rust enums.
And no, getting rid of std::variant and replacing it with much simpler and nicer language support for tagged unions (which would allow for good pattern matching in future versions) would be far less complex than what it is currently.
>>
>>60873711
He loves it of course, but in the way of really obtuse functions.
>>
>>60873712
Yes, it's not part of the language.
It's part of the standard library. Learn the difference, retard.
>>
File: questionrabbit.png (127KB, 795x1000px) Image search: [Google]
questionrabbit.png
127KB, 795x1000px
>>60873719
How do Rust enums work? I don't see what enums have to do with unions.
>>
>>60873648
>Coming in C++17
Speaking of C++17, when is it supposed to be coming out? according to this https://isocpp.org/std/status it's already out.
But when will GCC implement it?
>>
>>60873777
I don't know why Rust called them enums (fucking dumb name) but enums are a subset of tagged unions
>>
>>60873789
I've been using GCC 7.1. I think it has already most of C++17, if not all.
>>
>>60873777
>>60873820
*enums (C) are a subset of tagged unions
>>
>>60873777
Rust enums are tagged unions.
enum Foo {
Thing(i32),
AnotherThing(std::String),
Niggers(u8, u16),
};

...

let foo = Foo::Niggers(46, 4614);

// Can pattern matching against enums too:
match foo {
Foo::Thing(val) => {
...
}

Foo::AnotherThing(ref str) => {
...
}

Foo::Niggers(a, b) => {
...
}
}
>>
>>60873777

Rust enums are tagged unions, essentially a struct containing an integer tag, and a union containing each of the types of the enum elements. When all of the elements of the enum are of the unit type, they are functionally equivalent to a C++ enum class.
>>
>>60873871
t. Haskell shill
>>
Why is {} now used to call constructors in C++ rather than () now? it looks too much list an initializer list or array, it's confusing.
>>
>>60873889

>Haskell
Ewwww....
>>
>>60873896

Foo foo(Bar());
This looks like you're constructing a Foo named foo, and foo's constructor takes a temporary Bar().
In fact you are declaring a function prototype named foo that returns a Foo, and takes an unnamed function pointer that returns a Bar and takes void.

If you use {} this doesn't happen.
>>
why the fuck is C++ always touted as some sort of gentleman's / alpha male programming language? it is the normiest of normie languages. preferred language of pajeet. godawful syntax. horribly bloated.
>>
>>60873935
so basically, there's no need to use {} in 99.99% of all cases.
>>
>>60873956

That's Java senpai.
>>
>>60873935
Sounds pretty shit.

What about in situations like this?
#include <stdio.h>
#include <initializer_list>

struct Foo {
Foo(int a, int b) {
puts("normal ctor");
}

Foo(std::initializer_list<int> list) {
puts("intializer_list ctor");
}
};

int main() {
Foo{9, 4};
}


When you thought you were calling the normal ctor, you were actually calling the initializer_list ctor.
>>
>>60873956

Because it is difficult to actually master. Any idiot can copy paste some C++ code and make a half-working program that's faster than a Python program. To write good code, you need to understand the language well, and that's not so easy, considering it's a clusterfuck. But it's a clusterfuck that gives you a lot of control and power if you actually do know how to use it.
>>
>>60874009
Yep, it can be complicated if you have both kinds of ctor.
>>
>>60873871

So I could write something like this:
enum RpsAction 
{
Rock(void),
Paper(void),
Scissors(void),
};

let action = RpsAction::Paper();

match action
{
Foo::Rock() =>
{
// do rock stuff
}
Foo::Paper() =>
{
// do paper stuff
}
RpsAction::Scissors() =>
{
// do scissor stuff
}
}
>>
>>60874067

Yes, but it would look like this:
enum RpsAction {
Rock,
Paper,
Scissors,
}


And later:
use RpsAction::*;
let action = Paper;
match action {
Rock => { /* Rock stuff */ },
Paper => { /* Paper stuff */ },
Scissors => { /* Scissor stuff */ },
}


The syntax is not quite like C++.
>>
>>60874067
Fucked it up but I think you get the idea
>>
>>60874102

That's kind of elegant. It's quite unlike anything I've used before but it seems obvious to combine enums and unions now.

Does Rust have bare unions?
>>
>le C++ is bloated meme
So this thread is still filled by edgy self taught expert Kernel haxors huh
>>
>>60874125
But I'm writing a kernel in C++
>>
>>60873333
C++
IS
WORSE
THAN
JAVA
>>
>>60874123

No. If you want to do bare union type punning, you'd use std::transmute, which requires an unsafe block.

Also, interesting elegance in Rust regarding enums: null pointer optimization. If you have an enum with two elements, one of which is the unit type, and one of which is a non-nullable pointer type (such as a reference of a box), the resulting enum will take up the size of a single pointer, and use null pointers for the unit type. Hence, Option<Box<T>> uses a null pointer for None.
>>
>>60874154
JAVA
IS
WRITTEN
IN
C++
>>
>>60874216
this is definitely the shittiest argument I've seen this month
>>
>>60874216
So that's why Java is so shit
>>
I guess you get asked this often, so I apologise in advance.

I need an idea for a project. I'm unable to focus on programming unless it's for something that will be of some use to me later.

Any leads?
>>
>>60874216
>>60874227
also not for long
https://github.com/graalvm/graal
>>
>>60874237
are you asking us what would be useful to you?
>>
>>60874264
I'm asking for ideas. We're all humans in here, and you've probably been here before. I'm just looking for suggestions.
>>
Why do people even defend C++? It's a 40 year old failure.
>>
>>60874284
>If I say it loud and often enough it will because true.
You look pathetic.
>>
http://en.cppreference.com/w/cpp/language/class_template_deduction
C++17 is getting user-defined deduction guides
>>
>>60874227

It's not really intended as an argument; it's a quip.
>>
File: 1491081808903.jpg (56KB, 945x482px) Image search: [Google]
1491081808903.jpg
56KB, 945x482px
>>60874299
This hurts B*arne
>>
>>60874283
It's a shit question
>>
>>60874301
Maybe in C++66 it'll get modules
>>
>>60874284
>still in widespread use
>still in active development
>still the industry standard for high-performanec computing
>>
>>60874284
C++17 technically isn't even out yet tho.
>>
>>60874315
The purpose of C++ was to replace C, claimed by the language creator himself
>>
>>60874315
>rolling release language with 2 std libs
>hundreds upon hundreds of useless features
>CP con every weeek
>Still can't surpass C
>"C is obsolete guyz"
>>
>>60874237
>>60874310
Let me rephrase it.

Hey, /dpt/, which personal projects you've been involved with that have been useful to you?
>>
>>60874340
Where did I claim C was obsolete?
>>
>>60874340
>C is obsolete guyz
Why are you quoting? Certainly not C++ developers.
>>
>>60874350
You didn't the creator of language did, and still does
>>
>>60874345
Prostate masturbation while wearing programming socks
>>
>>60874340
> > rolling release language with 2 std libs
This meme is getting out of hand.
>>
>>60874353
B*arne the Micros**t shill
>>
>>60874361
std::string
boost::string
>>
>>60874345
Last things I built were ittle things like a solitaire app for my phone and an application to track my whisky sample collection.
>>
>>60874358
Bjarne's a faggot, now criticize the language.
>>
The patrician programming trinity:
>C
>C++
>OCaml
>>
>>60874345
you do know /dpt/ doesn't actually program anything useful, right?
>>
>>60874378
One of these is standard, the other is not.
>>
>>60874381
Worse than Java
http://www.quinn.echidna.id.au/quinn/C++-Critique-3ed.pdf
>>
>>60874404
>the other is not.
Stop lying
>>
>>60874383
Get rid of CPOOPOO and POOCaml and we are good
>>
>>60874419
>POOINLOOGUYZ :^D
>>>/pol/
>>
>>60874340
Rustshills are THIS mad that no one wants to switch over to their shit language.
>>
>>60874428
we're mostly just sad that it's been decades and there's still nothing better
>>
File: not_found.png (6KB, 483x153px) Image search: [Google]
not_found.png
6KB, 483x153px
>>60874378
>>
>>60874381
Horrible and ugly syntax, shitty types, no fucking modules in the year of 2017, useless bloated features that lead to shitty design oh boy
>>
>>60874424
>>60874428
>>>/pol/
>>
>>60874439
Now search in std beta
>>
>>60874414
#include <string>

int main() {
boost::string str = "niggers";
}

$ g++ main.cxx
main.cxx: In function ‘int main()’:
main.cxx:4:2: error: ‘boost’ has not been declared
boost::string str = "niggers";
^~~~~


Sure is standard
>>
>>60874453
Boost is just the beta version of standard library
>>
>>60874436
My condolences faggot: your shilling is fruitless. I recommend you shill on dumblr or plebbit. They'd be more open to your "safe" shit for sissies.
>>
>>60874458
So basically what you're saying is that C++ doesn't have two standard libraries? We all know that already.
>>
>>60874462
C++ajeet getting triggered
LOL I see this everyday
>>
>>60874453
That's like saying the math library isn't standard in c
>>
>>60874451
No you fuck off, rustshill.
>>
>>60874475
>C++ doesn't have two standard libraries?
Of course it has two standard libraries, std stable and std beta (aka boost)
>>
>>60874484
Fuck off back to your daycare board >>>/pol/, manchild C++ apologist
>>
>>60874493
I'm not from /pol/ you triggered little shill. Die choking on a dick.
>>
>>60874480
libm is standard though.

>>60874486
>std beta
Not standard.
>>
Daily reminder two-stdlibs-fag is a butthurt projecting D-fag. D language actually had two standard libraries at some point in its history.
>>
>>60874505
>Not standard.
Standard beta
>>
>>60874505
>libm is standard
Can you not read?
>>
>>60874514
C++ still has 2 standard libraries
>>
>>60874514
It's really pathetic honestly.
>wow this language has a third party library with features overlapping with the standard library lmao sepples amirite
>>
C++ has two compiler dependent module implementation. what a joke LOL
>>
>>60874516
No such thing exists in C++.
There is the C++ standard library, which is standard. And then there is Boost which is not standard and not even associated with the standards committee.

>>60874522
libm is standard
boost isn't
It's not really that hard
>>
>>60874538
>No such thing exists in C++.
It's called "Boost"
>>
>>60874125
Just memesters farming (you)s.
>>
>>60874538
Boost is the standard beta, stop lying.
>>
>>60874514
Do either of them work without the GC?
>>
>>60874538
>libm is standard
>boost isn't
That is not relevant to what the initial counter argument was
>>
>>60874514
>D
Don't even try, it's been 40 fucking years and C++ can't enumerate foreach loops AHAHAHAH
>>
>>60874541
>>60874548
And "Boost" is not standard.
It's developed and maintained independently.

What would you do if I started developing an independent alternative standard library for Rust or D?
>>
PYTHON

dict.get(key, set())


what does this do? what happens if the return value is a function. I dont understand
>>
>still giving (you)s to skiddy shitbirds
>>
>>60874552
Neither of them are known to work with GC enabled since no one tried using D.
>>
>>60874558
>It's developed and maintained independently.
And then added to the next relese of C++ standard.
>>
>>60874559

show context
>>
>>60874553
The initial counter argument was irrelevant.
>>
>>60874558
It's developed independently as an experiment and then C++ committee includes it 4 years later
>>
>>60874557
Rust doesn't have this problem
>>
>>60874571
>>60874584
That doesn't somehow make C++ have 2 standard libraries at a single point in time.
>>
File: 1489153247034.jpg (34KB, 480x360px) Image search: [Google]
1489153247034.jpg
34KB, 480x360px
Good thread keep it up.
>>
>>60874589
But it does? std stable and std beta?
>>
>>60874581
>Trying to defend up your trash logical thinking
>>
>>60874589
Well you got experimental standard library and the legacy one
>>
>>60874571
>>60874584
Don't you know that Rust does the same thing?
They develop things in non standard crates, and then include it into the standard library later.

Rust LMAO, more than 2 standard libraries!
>>
>>60874604
Rust admits openly that it has nightly builds. B*arne and his fellow micros**t shills don't
>>
File: cover.jpg (51KB, 400x579px) Image search: [Google]
cover.jpg
51KB, 400x579px
I'm reading through the SICP and I'm getting caught up on an exercise
I think I might be retarded

Excercise 1.11 asks you to write a linear recursive, and linear iterative version of the same function

function f such that f(n) = n if n < 3
and if n >= 3 f(n) = f(n - 1) + 2f(n - 2) + 3f(n - 3)

The linear recursive implementation is a walk in the park
(define (f n)
(cond ((< 3 n) n)
(else (+ (f (- n 1))
(* 2 (f (- n 2)))
(* 3 (f (- n 3)))))))


The linear iterative however I'm having much more trouble wrapping my head around

I looked it up at http://community.schemewiki.org/?sicp-ex-1.11
but honestly even seeing the implementation on the screen is still so confusing, I've re-read the descriptions of linear iterative processes a couple times now, and while I understand it in principle I just don't feel like I have a firm grasp on how to write one, is this normal? Should I just keep practicing? Or do I need to read up on mathematics, which has always been my weak spot, in order to properly understand the book.
>>
>>60874604
Probably because the language is young, unlike a 40 year old running failure like C++
>>
>>60874616
Still, Rust has multiple standard libraries!
LMAO
M
A
O

WHAT A JOKE
>>
>>60874628
>it's ok when my toy shitlang does it
>>
Why do pajeets and windows shills love C++ so much, lads?
>>
>>60874630
Yes, they have properly structured them and called them nightly, not """"Boost"""" nonsense

>>60874633
I think B*arne is a paid windows shill
>>
>>60874633
I'm a straight white male who uses Arch, though.
>>
>>60874632
It's not okay when a long running stale jokelang does it
>>
>>60874633
>pajeets
>C++
uhhhhh
>>
I came across this reddit post and wanted to ask if this is true:

I have not been a professional software developer long. But it pains me to see how people go about learning to code. There is no simple trick or secret save for this: most developers write scripts not programs. Knowing the basics is literally all you need in the professional world ( ie an actual company).
Very few corporate developers write entire programs. Those are the elite among even the employed developers. What 'noobs' dont understand is that companies have large code bases and working programs that often need maintained or improved by the 'basics'. This requires fixing it with an often small amouny of code to actually make work since the framework already exists. This framework is (roughly) called the architecture, and is the design and implementation of software. That is a whole new beast.
Once you know the basics then you know what you need to know to be an entry level developer. This is hard for the 'noob' because they feel like that cant be all there is. Well to bad. It is. Writing larger programs is still just stringing multiple smaller scripts into a larger file to hold it all in one place.
O and did i mention that i had a relatively unreleated degree (bs and ms in mathematics) when i was hired to be a developer? I learned from the same websites and books as everyone else when i got here.
>>
>>60874649
>Arch
Faggot spotted
>>60874654
>C with POO
Of course
>>
File: 1486403872071.png (174KB, 962x543px) Image search: [Google]
1486403872071.png
174KB, 962x543px
>>60874654
Pajeets absolutely love C++. C++ is for pajeets that think they are "too smart for Java"
>>
>>60874645
Except "Boost" is not affiliated with the committee, neither did the committee ask for it.
It's an independent project.
Doesn't matter if features from it get included into the standard.

Rust shills truly are pathetic.
>>
A ruby script for my parents restaurant. It parses iver the Xcel schedule, gets the times every employee works, then sends them a text with days and times for shifts. Any suggestions /g/?
>>
>>60874649
>straight white male
>Arch
Nice try
>>
>>60874677
>Rust shills truly are pathetic.
You're still replying to them though.
So am I.
>>
>>60874657
>I came across this reddit post
>>
>>60874677
>Except "Boost" is not affiliated with the committee
And that's really bad. If your std beta is created by random basement dwellers instead of the core committee you know your going downhill
>>
>>60874657
>O and did I mention
>In written text
Retard. Oh, did I mention that of course they wouldn't have some mathematician design software architecture.
>>
>>60870341
I am the 1/0 of my GET.
LISP is my body, and SICP is my blood.
I have created over 999 HUGE programs that you couldn't even comprehend.
Unaware of Python.
Nor aware of Ruby on rails.
Withstood the forced indentation of the code to create many touring-complete programs.
Waiting for an EXPERT PROGRAMMER's arrival.
I have no regrets, this was the only path.
My whole life was /prog/.
>>
>>60874678
but can it make pasta?
>>
>>60874624
keep practicing. i don't think mathematics will help you much with their way of defining iterative procedures.
>>
>>60874537
>>60874405
CPOOPOO BTFO
>>
>>60874657
you must work for windows if this is your design process
>>
>>60874726
>POO lang
>also have to manage memory
kek it's like the worst of the to worlds jammed together
>>
File: c++.png (40KB, 1620x774px) Image search: [Google]
c++.png
40KB, 1620x774px
>>60874669
>>
>>60874677
>the committee
You mean Microsoft, right?
>>
>>60874360
Programming socks?

>>60874379
That sounds nice. I'll try my luck with black jack.

>>60874391
I thought you guys did.
>>
>>60874742
>Horribly bloated ugly mess
Just like their sponsor microsoft's wankbloz
>>
>>60874759
>Programming socks?
Google it newfriend.
>>
>>60874760
They think alike. Although Microsoft was a success, C++ is going to remain a failure forever
>>
>>60874771
>Programming socks
I'm coming up with confusing stuff.
>>
>>60874782
kek even Java is more successful than C++
>>
>>60874797
Java is a better language than C++
>>
>>60874796
The stripped ones are the best.
>>
C++ is even more of a clusterfuck than Java. The only thing it has going for it is speed.
Also, I want to dispel with the notion that Java is the pajeet language. No, almost all OOP languages are loved by pajeet. Pajeet programs in whatever is most popular and marketable - JS, Java, C++, C, PHP, Python, Ruby, etc...
>>
>>60874839
>Pajeet programs in whatever is most popular and marketable - JS, Java, C++, C, PHP, Python, Ruby, etc...
So Pajeet is the normie of the programming world? Really gets the noggin joggin.
>>
>>60874839
This. See >>60874669
>>
>>60874839
>The only thing it has going for it is speed.
Rust is faster
>>
>>60874839

>Java is a clusterfuck
What? Java is pretty bare, that's why you need so much boilerplate.
>>
>>60874839
Only pajeets have jobs
>>
>>60874878
C++ is both bloated and you gotta write boilerplate
>>
>>60874896

Oh I see, you simply haven't written any of C, C++ and Java.
>>
>>60874939
I don't use POOlangs
>>
>>60874878
so sick of the java boilerplate meme. maybe java circa 2001, but newer versions have added a lot to mitigate the "problem". there are also popular libraries such as lombok one can use to reduce boilerplate. also good programmers don't write getters and setters for every single fucking instance variable.
>>
>>60874559

example
v1 = {'a': 1}
print(v1.get('a', set()))
# output: 1
print(v1.get('b', set()))
# output: set()


dict .get return value of the if key, if not found return the second argument

https://stackoverflow.com/questions/11041405/why-dict-getkey-instead-of-dictkey
>>
NEW THREAD!!

>>60874998
>>60874998
>>
>>60872523
Why do you need generics?
>>
>>60874967

Java 8 fixed some of it but it's still rampant. Java 8 seemed to compromise Java's purity any way.
>>
>>60874299
>it will because true
what did she mean by this?
>>
>>60876257
she meant
N E W T H R E A D
N E W T H R E A D
N E W T H R E A D
N E W T H R E A D
N E W T H R E A D
>>60875002
>>60874998
Thread posts: 324
Thread images: 22


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