[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: 330
Thread images: 38

File: 1505028853743.jpg (131KB, 591x800px) Image search: [Google]
1505028853743.jpg
131KB, 591x800px
What are you working on, /g/?

Old thread: >>62349370
>>
File: 1414302898330.png (202KB, 440x506px) Image search: [Google]
1414302898330.png
202KB, 440x506px
Why do people think they can "save the world" and become a catalyst for "social change" with their programming?
>>
Why do people think they can "save the world" and become a catalyst for "social change" with their shitposting?
>>
>>62357011
""""people""""
>>
File: 1504537768793.png (23KB, 383x400px) Image search: [Google]
1504537768793.png
23KB, 383x400px
What's bloat and what's not?
What's the limit after which I should care about the size of my program?
>>
File: 1499158142957.png (572KB, 563x706px) Image search: [Google]
1499158142957.png
572KB, 563x706px
Are you a little Anime girl?
http://www.strawpoll.me/13845606
>>
>>62357023
they are sjw
>>62357011
they are alt right

gods we need a stalin to deal with these faggots, if you don't want democracy you should be getting what you really want
>>
>>62357070
it all depends on the why it's heavy. If it's justified = not bloat
>>
File: 1504819060636.gif (4MB, 600x253px) Image search: [Google]
1504819060636.gif
4MB, 600x253px
>>62357070
bloat is just anything that isn't critical to the function and usage of the program
Bloat also refers to achieving the critical function of the program though very abstract and obfusicated means that could otherwise be heavily optimized
>>
>>62357011
people don't really think like this
there are no real SJWs
it's a false flag operation by the alt right to delegitimize the liberal position on every issue
>>
why are all the ultra autistic programmers from scandinavia?
>>
why can't you do
vcvarsall.bat x64
in powershell what the FUCK
>>
>>62357309
I've met people in real life who say that
>>
File: Me101115c_400x400.jpg (28KB, 400x400px) Image search: [Google]
Me101115c_400x400.jpg
28KB, 400x400px
>>62357321
[citation needed]
>>
>>62357070
Is not about the size, is how you use it.
>>
>>62357070
Few programs need should be over 64 KiB.
Apollo 11 got to the moon with 32 KiB ROM.
>>
File: my_journey_to_the_stars.gif (1MB, 636x481px) Image search: [Google]
my_journey_to_the_stars.gif
1MB, 636x481px
>>62357352
I said ultra autistic not ultra schizophrenic
>>
>>62357382
>look at me I'm special faggot who supports HDD manufacturers' kikery and counts bytes in 1000!
Pathetic.
>>
File: binary prefixes orgs.png (289KB, 1280x905px) Image search: [Google]
binary prefixes orgs.png
289KB, 1280x905px
>>62357446
>>
File: 1503947523224.jpg (24KB, 370x363px) Image search: [Google]
1503947523224.jpg
24KB, 370x363px
>>62357011
Do not shitpost using Akari.
>>
File: 1487022728214.png (626KB, 840x904px) Image search: [Google]
1487022728214.png
626KB, 840x904px
Have you had your fill of LainO'S today, /dpt/?
>>
Does Rust even have async IO in the stdlib yet? For a systems language it's kind of an essential feature
>>
>>62357507
You ain't foolong anyone here, kike.
The only reason that distinction exists is because HDD manufactures paid to ISO so they couldn't be sued for giving us less bytes in kilobytes, megabytes etc.
>>
>>62357011
code is law
>>
const int main[] = {
-443987883, 440, 113408, -1922629632,
4149, 899584, 84869120, 15544,
266023168, 1818576901, 1461743468, 1684828783,
-1017312735
};
>>
File: 1497714627293.jpg (7KB, 210x250px) Image search: [Google]
1497714627293.jpg
7KB, 210x250px
what the FUCK is this
*
*
* HC12 i/o register locations (9s12dp256)
*

ifndef REG9S12 ; include only if not yet included

REG9S12 EQU 1 ; for testing inclusion of this file
*
Porta: equ 0 ;port a = address lines a8 - a15
Portb: equ 1 ;port b = address lines a0 - a7
Ddra: equ 2 ;port a direction register
Ddrb: equ 3 ;port a direction register

Porte: equ 8 ;port e = mode,irqandcontrolsignals
Ddre: equ 9 ;port e direction register
Pear: equ $a ;port e assignments
Mode: equ $b ;mode register
Pucr: equ $c ;port pull-up control register
Rdriv: equ $d ;port reduced drive control register
Ebictl: equ $e ;e stretch control


looked up the table at http://ref.x86asm.net/coder32.html and found nothing for equ ?? WHAT THE FUCK DUDE!?
>>
>trying to write GUI shit on linux
>nearly all scripting languages are hopeless at anything but text output
>suddenly realize why all these idiots "prefer" the terminal
how did I never notice this before?
>>
>>62358043
what are you even talking about
>>
I'm ashamed of using unity for everything visual. Where is a good place to start learning how to make a basic mesh renderer?
>>
File: 1458816261244.jpg (34KB, 493x533px) Image search: [Google]
1458816261244.jpg
34KB, 493x533px
>Be a person of colour
>Browsing a facebook group
>Someone posts a chart of "% of female developers in different countries" in hacker-rank
>I ask why the notion of female devs is a distinguishable trait
>Get called a NEET
>Get called unprofessional
>Someone blocks me and says that he's not connected me in anyway

All because I asked why it is important that the developer is a female.
*sigh*
>>
>>62358088
lol an unsurprising response
>>
>>62358043
Try PyQt or PyGObject.
>>
File: 1455947477437.png (129KB, 314x278px) Image search: [Google]
1455947477437.png
129KB, 314x278px
>>62358043
>all scripting languages are hopeless at anything but text output
>suddenly realize why all these idiots "prefer" the terminal
How are they correlated?
>>
>>62358043
the terminal is better you noob. git gud
>>
How can I get a programming job without a CS degree?
>>
>>62357309
>there are no real SJWs
yes there are in the san fagcisco bay area, seattle and (to a lesser extent) in other metropolitan areas
>>
>>62358037

Equ isn't an instruction, but an assembler directive, like db, dw, dd, and dq. It functions roughly equivalently to C's #define.
>>
>>62358390
Easy. Make an anti-diversity memo, spread that shit all over for maximum media attention, get famous and see the right wingers drooling all over to get you hired.
>>
>>62358390
become a tranny
>>
File: 1456923792222.png (202KB, 400x474px) Image search: [Google]
1456923792222.png
202KB, 400x474px
>>62358442
That's actually a good idea, never thought about it that way
>>
>>62358307
>facebook
gayer than reddit
>>
>>62358307
to* me
>>
I wonder when people will start developing malware in Rust...
>>
>>62358708
https://securityaffairs.co/wordpress/51126/malware/linux-trojan-irc16.html
>>
memory-safe memory exploits
>>
>>62358351
Looks like python is the only sane choice then.

>>62358366
Some code monkey learns scripting then they have to use the terminal because they can only output text. Stockholm syndrome sets in.

>>62358368
Yeah I only right-click extract with my dumb UI. While you get the joy of reading the tar man page again.
>>
>>62358817
http://bropages.org/
>>
>>62358718
why don't the linux fags just patch the vulnerabilities. fucking unacceptable
>>
>>62358817
>Yeah I only right-click extract with my dumb UI. While you get the joy of reading the tar man page again
first:
$> tar -xvf filename.tar[whatever]

Now the reason for that is imagine having to manually select each tarball right click extract, or you can do:
$> tar -xvf *.tar[whatever]

what is more efficient?
>>
>>62357347
Because Microsoft doesn't give a fuck about any developer which doesn't use their idea of a programming environment.

That batch file took forever to come about and is worth about the same as a turd on the sidewalk. To modify it is asking Microsoft to use a few man-hours from a semi competent person to do so, which will bring 0 profit back to them, in fact their salary will be a loss.

Even if you gave ms a vcvarsall.ps1, they wouldn't give a shit. It's not profitable to publish it.
>>
>>62357011
I wanna destroy the world and become a catalyst for global thermonuclear war with my programming

I probably will just make a shitty chatbot though
>>
>>62358949
When was the last time you had to batch extract archive files?
>>
>>62359004
everyday you dumb fucking nigger. Type to me one more time and see what fucking happens.
>>
>>62358911
A trojan isn't a vulnerability, it's just a program using the same facilities available to all other programs.
>>
>>62359016
Then your methods are flawed. This wasn't typed btw, it's a new advanced teledildonics system.
>>
>>62359048
lame
>>
>>62356950
Why is Ruby generally disliked by /g/?
>>
any webdevs around? What do I do if I want to setup a small locally hosted QA website like StackOverflow? ie whats the best free/open source thing I can use?
>>
>>62359097
Productivity triggers the NEET.
It goes against the NEET's way of life.
>>
>>62359098
go ask /wdg/
>>
>>62359098
>>/g/wdg is probably a better place to find webdevs.
>>
>>62359097
Easy things allow people who aren't willing to put in a lot of effort create things that bitter /g/ents had to slave over. That and Ruby and JS and stuff kind of skip over memory management, let you be sloppy etc and have the language pick up after you so it sucks working with those devs on systems programming projects (stuff that uses C and C++ typically)
>>
>>62359079
Well yeah, there's nothing impressive about trojans. They're not really meant to be either, unless you take those older ones with a fancy control panel and shit made to impress the other l33t h4x0rZ.
>>
How long before language comes along where you can just type full on English sentences and compile it to machine?
>>
>>62359127
>>62359097
/g/ really hates are people who can hack around small problems but fall apart on any project of non-trivial size. we'll call these people noobs for lack of a better nonce. noobs typically know ruby of javascript or some other language with a shallow learning curve. noobs rarely learn C or haskell. after a while, people on /g/ start to dump on anybody asking ruby questions because more often than not, it's another noob who deserves derision.
>>
>>62358949
>-v
You can tell a retard by this simple sign. They think terminals are efficient because they have no mouse and they like to run verbose flags on every single command.
What's the point in being le hacker dude if you don't see thousands of lines fly down the terminal.
>>
>>62359097
honestly I've never been able to successfully install it
>>
>>62359072
oh yeah well my computer just hooks up to my dick and types for me
>>
>>62359204
English is a shit programming language.
And any mad man who attempts to create a lexer and parser for "natural" English (Talk like you would to a person instead of a machine who takes English commands) is terry-levels of crazy.
>>
>>62359217
simpler languages are a stepping stone and I don't think people who learn them should be discouraged
>>
>>62359238
>terry-levels
who is terry?
>>
>>62359256
get out
>>
>>62359249
you are correct; i didn't mean to defend the practice of hating on those people, i only meant to explain why /g/ does it.
>>
>>62359237
You seem to have a grave misunderstanding of what the dildonics part means. It has nothing to do with your penis.
>>
>>62357827
Nani?
oringinalietocometio
>>
>>62359127
Why Ruby and not, like, Java or Python or something? Those two are more common, aren't they?
>>
just bought the dragon book for $8 on 'zon and a quantum computing book for $40
>>
>>62359310
whats the dragon book
>>
>>62359304
>grave misunderstanding
is there another kind?
>>
>>62359322
compilers
>>
>>62359310
So now that you've wasted $48, have you reconsidered your current way of life?

You can always become a kamikaze pilot or something, never give up.
>>
>>62359308
people hate on java, too, for the same reason (lots of substandard java devs out there). maybe python isn't trendy or popular enough?
>>
>gargbage collection is bad
>/g/ likes lisp
>lisp has GC
>lisp likes garbage collection
>>
Is all web development just forms?
The equivalent of paperwork?
>>
>>62359322
this >>62359332
but i got the oldest and cheapest edition i could find
>>62359348
it's not a waste of money if you're having fun
>>
Is it possible to have this method signature?
public static void removeDuplicates(ArrayList list)
>>
>>62359360
Lisp always gets a free pass for everything.
And lisplets never have a real defense or reason why Lisp is good for anything practical.
>>
>>62359383
im a dumb, so forgive me but if it's static it won't modify instance vars or params, and if it doesn't return anything, why have it?
>>
>>62359330
A mild misunderstanding, e.g. that life is worth living.
>>
File: slow.png (30KB, 986x569px) Image search: [Google]
slow.png
30KB, 986x569px
I'm stuck with windows for a while and installed codeblocks (got the WIN10SDK problem in visual studio). Is it supposed to be this slow?
>>
Java question here,

How often do Java devs use interfaces? Im learning this now and was wondering if it gets more complex down the line.
>>
>>62359399
It could modify the ArrayList passed in, or global state.
>>
>>62359264
what
>>
>>62359399
Because with void you can still change instances using setters.
>>
So I have to teach Unity to a bunch of kids and I've never worked with it before. Naturally I look for some kind of getting started thing and am amazed that fucking everything is a video tutorial. Why has text documentation died? I hate pausing and unpausing videos and not being able to skip around meaningfully. Fucking ADD generation can't do anything unless there's a pretty moving picture on their screen jesus christ.
>>
>>62359256
www.templeos.org
>>
>>62359383
also, can I have ArrayList<Integer> as a parameter type?
>>
>>62359428
haha fag
>>
>>62359360
>gargbage collection is bad
No one actually believes this. If you push people on it they'll either turn out to be repeating some shit they heard someone else say or they have an actual argument for why GC is bad in like embedded environments but grudgingly agree it's a good thing in general.
>>
>>62359434
Autism?
>>
>>62359447
why don't you type that and see if your compiler complains. You know sometimes that's easier than asking /dpt/
>>
>>62359447
Yes, please do that instead of taking raw types.
>>
>>62359460
Java isn't interpreted.
>>
>>62359452
>No one actually believes this.
or if they do they are clueless idiots who don't know how to do "manual" memory management properly and just malloc/free everything
>>
absolutely and many will say there's nothing wrong with it. imo you should use generics, though. also, use the interface (List) instead of the implementation (ArrayList). try
public static <T> void removeDuplicates(List<T> list)

and imo you should return a copy of the list insted of modifying it and have a singature like this
public static <T> List<T> removeDuplicates(List<T> list)
>>
File: disgust.jpg (20KB, 306x306px) Image search: [Google]
disgust.jpg
20KB, 306x306px
> want to write something with x11 to learn it

> friend asks "why I don't just use a web server or electron instead"
>>
>>62359473
the bytecode is interpreted by a virtual machine
>>
>>62359413
>codeblocks

for what reason?

install sublime text and open cmd to compile your files
>>
>>62359479
>talk to normies
>bitch about normies being normies
>>
>>62359419
all the time, it's hard to write a java program without them.
>>
>>62359481
THERE IS NO REPL
>>
>>62359479
>frogposter


figures
>>
>>62359488
That's what 4chan is for, friend.
>>
>>62359413
It might be timing the initialization of your process and the parent console.

Just a guess, like timing system("cmd /c program.exe")
>>
>>62359476
My teacher wants it like in here>>62359383
I'm still learning about generics, and they're very confusing 2bh.
>>
>>62359496
https://blogs.oracle.com/java/jshell-and-repl-in-java-9
>>
>>62359515
then do what your teacher asks :)
>>
>>62359476
>public static <T> void
What is this shit and is he not error?
>>
>>62359549
generics meme
>>
How come I can understand Haskell more than Generics.
>>
>>62359395
Speed!!
http://www.paulgraham.com/avg.html
I guess it used to make sense before the dotcom and a little after it, to use a lisp dialect to speed up development and getting a bigger share on the market early, nowadays the best case would to use functional programming principles on large sets of data, I think this is why scala is attractive to some companies. In conclusion, nowadays the only thing lisp contributes to is it's high-order functions and select items on the functional paradigm.
>>
>>62359549
in haskell this is just
Functor a => a -> ()
>>
>>62359566
Because FP'ing makes the most logical sense once you unfuck your brain from IP nonsense.
>>
>>62359559
I get that part, but how would it be valid in front of void?

Don't Java btw
>>
>>62359566
because you've used haskell more than generics? Java's generics pretty meh but they're not hard to understand
>>
>>62359575
>rev. April 2003
I'll let you try again, lad.
>>
>>62359577
In brainfuck this is just
[,]
>>
>>62359589
Because its still necessary for the parameter's list.
I had that confusion too lol.
>>
If FP is so great how come there are no graphics libraries that aren't just bindings to C?
Checkmate, cia niggers.
>>
>>62359599
>before the dotcom and a little after it
Like I said there is no real use of Lisp by itself, but parts of the Lisp language are the new buzz in the industry.
>>
How do I set c++ standards in QtQuick?
>>
>>62359623
What do the parameters have to do with the functions return type?
>>
>>62359658
// not generic 
public void foo(List<Integer> a) { }

// generic
public <T> void foo(List<T> a) { }

the first only works on lists of integers. the second works on lists of any type
>>
>>62359619
In cat this is just
>>
>>62359629
Everything's a binding to C.
>>
>>62359688
Oh I see, since there's no template shit they just shoved that into wherever.

What does a generic return look like?
>>
>>62359728
public <T> T firstElement(List<T> a) { 
T firstElement = a.get(0);
return firstElement;
}
>>
>>62359750
You could of just said that it looks like shit. Come on man, I'm trying to eat.
>>
>>62359691
This doesn't do the same thing, it's closer to cat > /dev/null but terminates on the NUL byte.
>>
>>62359457
genius and schizophrenia
>>
>>62359787
This is why you should just use haskell:
firstElement :: [a] -> a
firstElement a = a !! 0
>>
>>62359825
head
>>
>>62359837
yes, but this is for the steeplestards
>>
>>62359825
>>62359837
I think Johnny brainfuck's program has a better chance to be executed than this shit.
>>
>>62359865
head gets executed probably billions of times per day as part of Facebook's Sigma program
>>
>>62359886
And taking input with no result happens billions of times per instant, you just don't see it because you've been wasting your time learning Haskell.
>>
>>62359915
Actually, you probably see it all the time. How's your current program going?
>>
>>62359629
High-level languages in general are a meme with the exception of C++ and a few others.
As a rule any language that isn't implemented by a compiler is not really good for anything other than hobby projects where you do not have to worry about deployment.
>>
>>62360023
>a few others

Elaborate.
>>
>>62359223
I like doing anything involving networking or compilation verbose because a lot of time very noteworthy messages are displayed.
>>
>>62359310
I didn't like the dragon book
>>
Do you think the professor will take off points for implementing it this way?
    @SuppressWarnings("unchecked")
public static void removeDuplicate(ArrayList list) {
ArrayList temp = new ArrayList();
temp.addAll(list);
list.clear();
list.addAll(new HashSet(temp));
}
>>
KDE adopted Rust. Now there is an official interface between Rust-QML. You describe the interface between Rust and Qt in a simple JSON file. Then you compile the Rust code into a static library that you call from Qt. The user interface is still written in QML or C++. QML in particular is a wonderful language for writing user interfaces. And with these bindings, your Rust code will feel as a natural part of that user interface.

https://www.vandenoever.info/blog/2017/09/10/time_for_rust_and_qml.html
>>
>>62359249
Perhaps it's because certain fags never go beyond scripting languages, and those are the people that get flak.
>>
>>62359479
sasuga dumb frogposter
>>
Is C# a meme?

I know some Java but hate it. I hear people say that C# is the same thing but less fucking awful.
>>
>>62360330
It is locked down to not only its IDE but its fucking operating system. And before some faggot replies, look me straight in the face and tell me using a mono program on Linux works just as well as it does on Windows.

C# is objectively worse than Java and Java is shit.
>>
I'm growing stronger
#include <iostream>
using namespace std;

class Point {
private:
int x{0}, y{0};

public:
Point(int a, int b = 0) : x{a}, y{b} {}
friend ostream& operator<<(ostream& given_ostream, Point& p) {
given_ostream << "(" << p.x << "," << p.y << ")";
return given_ostream;
}
};

int main() {
Point p{1};
cout << p << "\n";
}
>>
>>62360361
people typically name it "os" rather than "given_ostream"
>>
>>62360330
Same garbage. C# has pointers I guess.
>>
>>62360207

Sounds nice. This will make it easier to create portable desktop applications in Rust.
>>
>>62360330
C# is the same thing, down to the amount of awful. C# is actually a little more awful, but you'll barely notice.
A few (copyrighted) things have different names (unless you're reading compiler errors, where the fake names are dropped), but that's the only difference on the surface.
Under the surface, C# has worse implementation. Something, something, less budget.
>>
Trying to learn Haskell for a class. I feel like I'm ramming my head into a brick wall with the syntax
>>
>>62360330
they're very similar when it comes to the basics, but beyond that, C# boasts a pretty solid list of nice-to-haves over Java

>>62360357
Roslyn has been open source and portable for quite some time, and Microsoft has been making substantial progress on their portable .NET runtime. regardless, if you set aside platform issues for the sake of argument, C# is definitely a better *language*, strictly speaking
>>
>>62360480
Learn OCaml instead.
>>
>>62360191
if you want to troll your professor, do it right
HashSet butts = new HashSet(list)
list.clear
list.addAll(butts)
>>
>>62360361
It keeps happening
#include <iostream>
using namespace std;

class Point {
private:
int x{0}, y{0};

public:
Point() {}
Point(int a, int b = 0) : x{a}, y{b} {}
friend ostream& operator<<(ostream& os, Point& p) {
os << "(" << p.x << "," << p.y << ")";
return os;
}
friend istream& operator>>(istream& is, Point& p) {
is >> p.x >> p.y;
return is;
}
};

int main() {
Point p{1};
cout << p << "\n";
Point p2;
cin >> p2;
cout << p2 << "\n";
}
>>
>>62360480
what part?
>>
>>62360533
>butts
no thanks
but, am curious
why can't I just
list = new ArrayList(new HashSet(list));
>>
>>62359413
Update your compiler.
>>
Now how can I instruct >> to stop reading at a delimiter?
In getline I can say (cin, target, delim)
>>
>>62360594
read until you get a delimiter then return the stream?
>>
>>62360610
yes.
>>
>>62360357
>>62360378
>>62360391
>>62360496
Well fuck, I got meme'd on again.

Where do I go from here?
>>
>>62360620
C++
>>
File: 1505098413260.png (70KB, 371x350px) Image search: [Google]
1505098413260.png
70KB, 371x350px
reminder that starting at an early age (when you're a kid) is a meme and those kids don't get much of a head start because they're brainlets

pic related is some nu-psychology pseudoscience but you get the idea
>>
>>62360594
You can't
>>
>>62360638
>crystallized intelligence
Ah. Someone in that IQ thread two days ago mentioned that. No wonder it sounded like complete bs if it's actual pseudoscience.
>>
>>62360594
Sepples streams are terrible pointless ways to handle input. The best you can say about them is that they're an api.
>>
>>62360678
>>62360638
Ability to learn decreases as you age (it decreases slower if you're physically active), but this looks like some grade C bullshit.
>>
>>62360614
the easy way would be reading in (assuming you are reading in a string or a char array) char by char and stop when you meet the delimiter
>>
>>62360564
I'm trying to do some stuff that would be trivial in an imperative language like return a boolean value based on whether an integer x is/is not divisible by some other numbers.

Maybe I'm a brainlet about how guards and how you should construct functions, but I have a hard time getting something that will compile, (although it should execute correctly because I understand boolean logic)
>>
>>62360622
Do I learn C first or jump straight into C++?
>>
>>62360760
What? No!
The creator of C++ himself forbids you to do so
>>
>>62360711
What was talked about in that thread was nothing about actual learning.
I'll just focus on forgetting it though.
>>
>>62360760
Not necessarily
Start reading http://www.learncpp.com/
>>
>>62360760
Anon if you wanted to learn programming you'd stick to a language until you know enough to know what switching gives you.

You need to articulate what you hate about Java for anyone to help you find something you don't hate.
>>
>>62360760
C is a language while C++ is a federation of languages. So no, pick one and only one to learn at a time.
>>
>>62360760
c is good old high level assembly
c++ 9x is oop nasty abomination
c++ 1x is voodoo magic
either learn c or c++, c++ is becoming another entirely separate thing.
>>
>>62360751
you can use if then else or guards

f x = 
if (x `div` 5) == 0 then
5
else
124

g x | x `div` 5 == 0 = 5
| otherwise = 124



Haskell isn't really about thinking "how this will compile" (not that you don't consider the efficiency of algorithms) unless you're doing really advanced stuff like writing a container library
>>
>>62360760
Unlike the other guy I will say, go for C first. I found it easier to learn, simpler, and it gives a better understanding of how memory works. C++ mostly just adds features to that but unfortunately almost all C++ tutorials start from the more advanced stuff needlessly, like classes, inheritance and what not.
>>
>>62360808
C++20 is even more different than C++11
I mean VERY different. With modules, UFCS and ranges
>>
>>62360847

Fucking WANT.
>>
>>62360620
but i was recommending it... if you want something in the neighborhood of Java but with a bunch of nice syntactic features and a higher ceiling (you may not necessarily have an immediate need for some of the features i have in mind, but they're the kinds of things that if you do end up needing them, you'll be really fucking glad they're there), it's worth checking out. it's actually getting pretty popular in the tech sector outside of Microsoft lately, perhaps surprisingly (just considering how late in the game it is). i know people at some big-name companies where they use it for all their tools, testing, automation, asset pipelines, servers, etc

C++ is great too, though. for different reasons (and different use cases). i use both C# and C++ extensively, and together they provide excellent functional coverage over the space of applications i'd imagine myself ever working on. fair warning, though, C++ is a rabbit hole like you've never seen. but really rewarding if you stick with it
>>
>>62360808
>high level assembly
This view doesn't hold anymore. It wasn't ever very accurate to begin with but now especially it makes no sense since compilers don't even do vectorization well (it's a hard problem).
>>
File: giphy.gif (39KB, 500x333px) Image search: [Google]
giphy.gif
39KB, 500x333px
>>62360847
>modules, ranges UFCS
Woaaaah
>>
>>62360562
Hey that's pretty neat, didn't know you could do that with "friend"
>>
File: ....jpg (18KB, 200x256px) Image search: [Google]
....jpg
18KB, 200x256px
>>62360847
STOP STEALING OUR IDEAS, SEPPLES
>>
>>62361016
>D
>Original
>>
>>62360985
Actually, with friends, you can safely take away the function body to a different file somewhere else.

You just have to remember to check if the signatures match
>>
>>62361016
Andrei is one of the core C++ dev team as well
>>
>>62360815
divisibility x = 
if ((x/5) /= 0) && ((x/2) == 0) && ((x/3) == 0) then
True
else
False


The parenthetical division is not my preferred way of doing it, but 'div' and 'mod' had a strange error with regards to TemplateHaskell in WinGCHi that I didn't want to deal with. There must be some sort of type mismatch, given the results I'm getting, but I don't know how to fix it.
>>
>>62361016

First we steal from Haskell.
Then we steal from D.

We'll absorb every useful feature from languages that could possibly make sense in a systems language, and put it all into a bloated mess that is impossible for an amateur to make a compiler for.
>>
>>62360751
bretty easy senpai
isMultiple n = and . map (divisible n)
where divisible x y = (mod x y) == 0

isMultiple 16 [4, 2] => True
isMultiple 30 [15, 4] => False
>>
>>62361086
>steal from Haskell
good thing brainlets cant understand Haskell
>>
>>62361093
This is true.

t. brainlet
>>
>>62361073
(/) is fractional
div is integral (e.g. div and mod)
you don't get (/) for integer types unfortunately, they decided to make it distinct from div

"TemplateHaskell" sounds like a syntax error (i.e. it's confusing bad syntax with th syntax)
>>
>>62361063
It's called the C++ committee.
It's certainly not a dev team. They decide the spec. They don't implement beyond example implementation in the proposals they might make themselves.
>>
>>62361073
also you should look at >>62361090
there's actually a better way of doing this

divisible divs x = all (\factor -> x `div` factor == 0) divs


"all" applies a predicate and returns true if it's true for all elements of a thing, e.g. if all factors fit into x

you can then do

divisibility = divisible [5, 2, 3]
>>
File: !!!.png (130KB, 200x256px) Image search: [Google]
!!!.png
130KB, 200x256px
>>62361063
I DIDN'T APPROVE OF THESE CHANGES
>>
>>62361122
whoops, should be /= 0

Also are you sure you didn't mean mod?
>>
>>62360751
isMultiple n [] = True
isMultiple n a:as | div x y == 0 = isMultiple n as
isMultiple n a:as | otherwise = False
>>
>>62361243
>>62361122
>>62361090

Thank you for helping out a brainlet
>>
>>62361243
(a:as)
>>
>>62361320
oops thanks
>>
Scientific computing or informatics as an elective?
>>
I'm beginning to think you guys are wrong.
>>
>>62361369
scientific computing
>>
File: 1495278845111.jpg (75KB, 545x960px) Image search: [Google]
1495278845111.jpg
75KB, 545x960px
I'm beginning to think guys are lewd.
>>
>>62361434
/g/ is retarded and you should take anything you read here with a grain of salt
>>
Trying to learn Haskell, but am getting stuck on type signatures...

I'm trying to write a function that compares two values and returns a bool
fnC x y = if (x > y) then True else False


When I write the following line in GHCi, I get an error:
Prelude>fnC :: (Ord a, Ord b)=>  a -> b  -> Bool; fnC x y = if (x > y) then True else False


"--- Error Below --- "
<interactive>:6:61: error:
• Couldn't match expected type ‘a’ with actual type ‘b’
‘b’ is a rigid type variable bound by
the type signature for:
fnC :: forall a b. (Ord a, Ord b) => a -> b -> Bool
at <interactive>:6:8
‘a’ is a rigid type variable bound by
the type signature for:
fnC :: forall a b. (Ord a, Ord b) => a -> b -> Bool
at <interactive>:6:8
• In the second argument of ‘(>)’, namely ‘y’
In the expression: (x > y)
In the expression: if (x > y) then True else False
• Relevant bindings include
y :: b (bound at <interactive>:6:49)
x :: a (bound at <interactive>:6:47)
fnC :: a -> b -> Bool (bound at <interactive>:6:43)


What am I doing wrong, exactly?
>>
>>62361467
Ord a, Ord b means a and b can be the different types, but Ord only allows comparison between the same type. You want
Ord a => a -> a -> Bool
fnC x y = x > y
>>
File: 1479017862316.jpg (1MB, 1305x1237px) Image search: [Google]
1479017862316.jpg
1MB, 1305x1237px
I'll go out, have a walk and figure out what the problem is when I come back

#include <iostream>
#include <numeric> //gcd
#include <cmath> //abs
using namespace std;

class Fraction {
private:
int nom{0}, denom{1};

public:
void reduce(int& out_nom, int& out_denom) {
int sign = out_nom * out_denom < 0 ? -1 : 1;
int commonDenom = std::gcd(out_nom, out_denom);

out_nom = sign * abs(out_nom / commonDenom);
out_denom = abs(out_denom / commonDenom);
}

Fraction() {}
Fraction(int a, int b = 1) {
reduce(a, b);
nom = a;
denom = b;
}

friend Fraction operator*(Fraction& x, Fraction& y) {
return Fraction{(x.nom) * (y.nom), (x.denom) * (y.denom)};
}

friend ostream& operator<<(ostream& os, Fraction& f) {
os << f.nom << "/" << f.denom;
return os;
}

friend istream& operator>>(istream& is, Fraction& f) {
char op;
int temp_nom, temp_denom;
is >> temp_nom >> op >> temp_denom;
f = Fraction{temp_nom, temp_denom};
return is;
}
};

int main() {
Fraction f1, f2;
cin >> f1 >> f2;
cout << f1 * f2 << "\n"; // this is where I fucked up
}
>>
>>62361467
(>) has type
(Ord a => a -> a -> Bool)
I.e. the things you compare must be the same type, you can't e.g. do (True > "hello")

With an extension (GADTs) you could write
(Ord a, Ord b, a ~ b)
>>
>>62361467
>if .. then True else False
>>
File: 1501003280059.gif (722KB, 500x281px) Image search: [Google]
1501003280059.gif
722KB, 500x281px
>>62361547
Why are lolis so cute?
>>
>>62361620
you disguting peadophile
>>
File: 1493972667618.png (446KB, 379x583px) Image search: [Google]
1493972667618.png
446KB, 379x583px
>>62361645
Rude.
>>
>>62361645
>go to site with 5 years old girl as a mascot
>complain about pedophiles
>>
>>62361645
>replying to him
you played yourself
>>
Is a Lisp interpreter a good beginner project?
>>
>>62361547
>what the problem is
You wrote it in C++.
>>
>>62361661
Get raped and kill yourself, you retarded fucking faggot sack of nigger shit with down syndrome.
>>
>>62361701
its a good intermediate project
>>
has anyone ever had a ms sql/ sql server job?

i just started and from a mysql background i thought i was going to be writing the queries write into a CLI or something, but so far it seems like they dont even write queries since the SQL server software makes it so they can just click boxes and shit?

is that accurate? seems like they basically eliminated the sql from a sql job
>>
>>62361722
I don't believe lolis have a particular fondness for corpses.
I imagine most of them would be quite disgusted by it, really.
>>
>>62361701
It's too beginner.
(loop (print (eval (read))))
>>
File: 1503944814890.png (326KB, 1185x720px) Image search: [Google]
1503944814890.png
326KB, 1185x720px
>>62361728
Don't be so tsun, anon-kun~
>>
>>62361746
>Show about lolis
>Old hag is the best girl
>>
File: 1502157931382.png (3MB, 1280x2210px) Image search: [Google]
1502157931382.png
3MB, 1280x2210px
>>62361749
At least the old hag is an absolute bombshell
>>
>>62361645
Why is that pedophilia?
>>
What's the most user friendly data base? I want to use it with my C++ program to track my personal expenses
>>
>>62357121
>>62357135
>bloat is just anything that isn't critical to the function and usage of the program
So I can everything I don't use call bloat?
>Bloat also refers to achieving the critical function of the program though very abstract and obfusicated means that could otherwise be heavily optimized
There are several ways how to draw a rectangle to choose from. I can work directly with video memory, I can choose WinAPI/Xlib functions which will draw the recrangle for me, I can use canvas on the web page to draw the rectangle. So, everything except the first way is bloat?
>>
>>62361740
He never said "a Lisp interpreter in Lisp".
>>
>>62362300
>So I can everything I don't use call bloat?
Yes, everything you include in your program that isn't necessary for its core functionality is bloat.

>There are several ways how to draw a rectangle to choose from. I can work directly with video memory, I can choose WinAPI/Xlib functions which will draw the recrangle for me, I can use canvas on the web page to draw the rectangle. So, everything except the first way is bloat?
If you include heavy-weight third party libraries in your project just to draw a rectangle, then yes, it's just bloat, because you're including things in your program that aren't necessary for its core functionality.
>>
i'm terrible with recursion

anyone willing to tell me where i fucked up?

   public int[][] fastSolve() {
for(int i = 0; i < theGrid.length; i++){
for(int j = 0; j < theGrid.length; j++){
if(theGrid[i][j] == emptyCell){
for(int k = 1; k <= theGrid.length; k++){
if (isValid()){
theGrid[i][j] = k;
int[][] ans = fastSolve();
if(ans != null)
return ans;
}
theGrid[i][j] = emptyCell;
}
return null;
}
}
}
return theGrid;
}


seems to return null
>>
>>62362359
How would you do it? Interface directly with video drivers to do exactly what you need? But that would take 5k lines of code for something that should be 100 and won't be portable at all.
>>
>>62362449
What are you even trying to do...?
>>
>>62362449
>recursion
>posts O(n^3) nested for loop
>>
>>62362468
>How would you do it?
You're just cherrypicking a retarded toy example where the task you have to accomplish is too small for there to be an easy way to do it without bloat.
>>
in javascript

why cant you directly add properties to functions and you have to add it to it's prototype
>>
>>62362572
>why cant you directly add properties to functions
Who said you can't?
>>
>>62362582

I think I meant update
>>
>>62362482
solve a sodoku

isvalid() just returns whether the current board state is valid, meaning the columns only contain 1-n, the rows 1-n and the boxes 1-n, or blank spaces (emptyCell)

>>62362509
it has an element of recursion too it in that it calls itself, so theres that
>>
>>62362449
thats not recursion my man
>>
Writing my first CMakeLists.txt
>>
>>62362591
You can add properties to a function object and it'll work the same way as a property in any other object.
>>
>>62362449
public int[][] fastSolve() {
...
int[][] ans = fastSolve();

surely this is recursion?
>>
>>62362602
>thats not recursion my man
Yes, yes it is. The function calls itself:
>int[][] ans = fastSolve();
>>
File: 15611f2f59a1308b5d43f53608.jpg (15KB, 630x630px) Image search: [Google]
15611f2f59a1308b5d43f53608.jpg
15KB, 630x630px
What language(s) this syntax could be?
>>
>>62362635
java p sure
>>
>>62362613

oh I see. but how do I do

function Foo() {
}

Foo.this.name = "John"
>>
>>62362600
>solve a sodoku
I don't know how Sudoku works, but it's easy to see why you're recursion doesn't achieve anything useful: you're just calling fastSolve on the entire board all over again. You aren't reducing the problem anywhere.
>>
>>62362643

nevermind

I just realized this is bullshit anyway
>>
>>62362643
>Foo.this.name
Huh? You were talking about adding properties to the function:
Foo.name = "John";
>>
>>62358307
why didn't your privilege work for you?
>>
Anyone here use a cloud IDE?

I started using one and I can't get over how much more convenient it is compared to setting up Linux shit like msys2 on Windows. They gave me a ubuntu VM to develop in complete with terminal, editor and file system all in the browser. It's really neat.
>>
>>62362449
what's the point of the isValid check
>>
>>62362645
no it does work mostly

i have it sent to print out the board states as it goes

it takes
{ -1, -1, -1, -1 },
{ -1, 4, 3, 2 },
{ -1, 2, 4, 1 },
{ -1, 1, 2, 3 }

and gets at least as far as
{  2,  3,  1,  4 },
{ 1, -1, 3, -1 },
{ 3, 2, 4, 1 },
{ -1, 1, 2, 3 }
>>
>>62362679
checks all columns, rows, and boxes of the sodoku conform to the rules

so in a 3x3 sodoku each row, column and box contains 1-9, or a space to be filled (emptySpace)
>>
>>62362685
i typed that in wrong,

it gets as far as
{  2,  3,  1,  4 },
{ 1, 4, 3, 2 },
{ 3, 2, 4, 1 },
{ -1, 1, 2, 3 }


so basically it gets probably to the end and then returns null
>>
File: 1504254940373.png (1MB, 1280x1740px) Image search: [Google]
1504254940373.png
1MB, 1280x1740px
Employed Rust programmer here
>>
>>62362537
How about using browser to program a text editor?
>>
File: javascript.jpg (38KB, 713x490px) Image search: [Google]
javascript.jpg
38KB, 713x490px
ok I got it.

Is there a way to make this work?
>>
>>62362698
Horribly inefficient.
>>
>>62362762
What are you trying to achieve?
>>
>>62362449
>>62362685
>>62362724

so i just checked and the final array it returns is
2  3  1  4
1 4 3 2
3 2 4 1
1 1 2 3
>>
>>62362685
>no it does work mostly
>mostly
Your use of recursion just doesn't make sense. Try to explain verbally what you think your function is supposed to be doing. 4 out of 5 times you'll see what you're doing wrong.
>>
>>62362756
>using browser to program a text editor
No idea what that's supposed to mean. A text editor that runs in the browser? A browser modified to become a text editor? Using the browser as an IDE to program your text editor?
>>
so close!
>>
>>62356950
>lain

So, how's that chan going? I heard those edgy admins were finally kicked out. Is it a good place now?
>>
File: mountain_wew.jpg (165KB, 1280x738px) Image search: [Google]
mountain_wew.jpg
165KB, 1280x738px
>>62359223
-v on tar is useful because it lets you know where the files being extracted are. It often saves an ls, or lets you know you have to clean up the folder because the person who packed the tar didn't put everything inside a folder
>>
>>62362602
>>62362798

fixed it

needed to add a check for (isValid()) immediately before the final return, otherwise returning null
>>
File: 1502156877619.jpg (143KB, 1280x720px) Image search: [Google]
1502156877619.jpg
143KB, 1280x720px
>>62362823
Are you going to put the source in a public repo, anon?
>>
>>62362917
it already is, ill post it when its usable
>>
File: 1492237565277.jpg (90KB, 1280x720px) Image search: [Google]
1492237565277.jpg
90KB, 1280x720px
>>62362969
Sugoi!
>>
>>62363014
what's wrong with her eye?
it's massive
>>
File: 1492267649163.png (34KB, 348x318px) Image search: [Google]
1492267649163.png
34KB, 348x318px
>>62363030
It's her pride.
>>
>>62363049
she only has half a set of teeth?
>>
stop bullying anime girls!!!
>>
>>62356950
OWO
>>
>>62363071
im a professional loli bully, desu.
>>
File: 1504053534516.jpg (100KB, 1280x720px) Image search: [Google]
1504053534516.jpg
100KB, 1280x720px
>>62363085
She's not a loli though.
Now this is some prime loli.
>>
>>62362635
python
>>
>>62363014
>bleach shit
>>>/out/
>>
>>62363201
>bleach invented the concept of wearing a mask piece
>>
sigprocmask(2)
>The use of sigprocmask() is unspecified in a multithreaded process; see pthread_sigmask(3).
>Each of the threads in a process has its own signal mask.
>A child created via fork(2) inherits a copy of its parent's signal mask; the signal mask is preserved across execve(2).

pthread_sigmask(3)
>A new thread inherits a copy of its creator's signal mask.

So if I call sigprocmask on one of the threads in a multithreaded process, the behaviour is unspecified but if I call sigprocmask on a single threaded process and then run new threads, it's not? Is thread's signal mask inherited from the parent thread or does it get a new one?

Also, sigprocmask(2) says:
>It is not possible to block SIGKILL or SIGSTOP. Attempts to do so are silently ignored.
while pthread_sigmask(3) doesn't mention this. Does it mean I can block SIGKILL and SIGSTOP using pthread_sigmask(3)?
>>
>>62363183
>python
>braces
>>
File: 1503626345069.jpg (54KB, 550x528px) Image search: [Google]
1503626345069.jpg
54KB, 550x528px
why does everyone hate C?

>tfw just grasped function pointers
>>
>>62363353
>Does it mean I can block SIGKILL and SIGSTOP using pthread_sigmask(3)
You can't block SIGKILL and SIGSTOP.
>>
>>62363418
C is fine for what it is. It's pretty simple on the whole.
My only major gripe is a weak and inexpressive type system.
>>
>>62357679
You're dumb.
>>
>>62357827
Is this for 32 or 64 bit?
>>
>>62362814
He is referring to Atom, which runs on electron, a desktop program framework based on chromium(?)
>>
>>62363517
>no number exceeds 2 billion
I place my bet for 32 bits.
>>
>>62363418
No one hates C, tho I'm often annoyed by C-fags who shit on everything new without trying to actually understand it. Some retards even manage to shit on C11 ffs.
>>
>>62363567
No, that's because of variable type. int is 32 bits regardless whether you compile it as 32 bit or 64 bit program.
>>
>>62363572
>VLAs optional
C11 a shit
>>
>>62363554
>Atom
Bloat.
>>
>>62363587
VLAs can be replaced with the Builder Pattern, at no loss with function inlining.
>>
>>62363572
The only thing I shit on without trying is rust because so far it's a meme and the culture around it is horrible. I've put plenty of time into learning other languages though.

>>62363587
Whats the best C to use? C99?
>>
>>62363615
>Whats the best C to use? C99?
Look at the differences and decide for yourself.
Don't let anonymous shitposters make decisions for you.
>>
New thread:

>>62363622
>>62363622
>>62363622
>>
>>62362745
employed where
>>
>>62363420
Thanks.

What about the first question? It's more important to me desu. >>62363353
>>
>>62364055
Sorry, I can't say that for sure, and I would advise you against listening to anything 4chan says on this matter. Write a small program to test it.
>>
>>62364071
Why? GNU±linux is the one thing that /g/ can advise on.
>>
>>62364171
On ricing your desktop. Not on programming.
>>
>>62364071
Also, undefined behaviour means that if I write a test program, it will work on my system one way but I'm not guaranteed it wouldn't work the other way on a different system.

>>62364180
I have a good experience with asking /g/ for system programming related help. Also, I have a common sense so I won't do shit like push Boku no Pico on release branch just because /g/ have told me to do so.
>>
>>62364220
I'm too lazy to make SO account just for that.
>>
just a quick question

im starting to read C Programming language by richie, which compiler should i use to follow along the exercises? im downloading visual studio now, i just want something simple with a bit of highlighting
>>
>>62364446
Don't bother with an IDE, at least while you're learning.
Grab yourself a basic text editor like notepad++, a standard compiler like gcc or clang, and get comfortable.
>>
>>62364527
alright so i set everything up with gcc and its running now after a bunch of trial and error

im trying to compile my little hello.c program, i tried just doing gcc hello.c and also gcc hello.c -o hello, but when i try doing ./a.out or ./hello prompt says it doesnt know what "." means
>>
>>62365101
post the exact output of the prompt plz
>>
>>62365151
oh i figured it out, if i simply just type the filename "hello" not "./hello" stuff, it runs it

im not sure why it does but it just worked
>>
>>62365151
>>62365179
i have another question

if i do this as from the book:
#include <stdio.h>
main()
{
printf("hello, world\n");

the compiler says "hello.c:2:1: warning: return type defaults to 'int' [-Wimplicity -int] main()

why does it want only "int main()" and not just "main()" from the book?
>>
>>62365229
Which book are you learning from? It must be an old book if it's leaving the return type implicit.

Leaving out the "int" is the old way of declaring a function, you shouldn't really do it any more. Same with leaving out the parameter list.
>>
File: the-c-programming-language.jpg (26KB, 381x499px) Image search: [Google]
the-c-programming-language.jpg
26KB, 381x499px
>>62365295
this book

do you recommend any other books? ive been doing a little of the CS50 stuff, its really good but i kinda want a book

also thanks for the help so far, really appreciate it
>>
>>62365372
I don't know many C books, but that would should be fine. Just keep in mind that there will be little differences between that and modern C.
>>
>>62365464
ill keep working at it, its actually pretty fun and satisfying when stuff works
Thread posts: 330
Thread images: 38


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