[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: 312
Thread images: 15

File: dpt_flat.png (102KB, 1000x1071px) Image search: [Google]
dpt_flat.png
102KB, 1000x1071px
Old thread: >>60723587

What are you working on, /g/?
>>
Re-writing JS in WASM
>>
Teach your pet snakes to write software
>>
>>60733530
>pet snakes
Snakes are illegal where I live.
>>
>>60733466
Hence the quotes. I guess I should have said `language features` instead though.

That said, compilers are pretty smart about some things, but you do have to be pretty careful. The point about adapting the design around the language features based on an expectation of what the compiler can/will do is very good.
>>
File: old_hag_langs.png (173KB, 600x355px) Image search: [Google]
old_hag_langs.png
173KB, 600x355px
ωth for Fortran.
>>
What do you think of JBlow's relative pointers, /dpt/?
>>
In layman's terms; what makes a certain language faster than others?
>>
>>60733651
>not using FORTRAN77
>>
>>60733694
If language A can perform a run-time task faster than language B.
If LA can compile faster than LB.

Those are the main two.
>>
>>60733694
LEVELS OF ABSTRACTION AND MEMORY MANAGEMENT
>>
>>60733694
That's a very complicated question, without an easy answer.
I'll give the hand wavy answer specific to C. All of the operations that C supports is very close to how the hardware actually works. It also allows compilers a lot of room for optimisations. They can exploit the shit out of undefined behaviour and the fact they're allowed to pretend it never happens.

That's not the only way to write a fast language, though.
>>
>>60733689
I think they're great. I think a general audience will miss the point of the language but I'm perfectly fine with that.
>>60733694
>fast
As in performance?
Either it takes away control from you and restricts you in a way that lets a compiler make good code that fits your intent.
Or it gives you control and lets you write the fast thing.

There's a bunch of languages that are designed without aims of being particularly fast, just fast enough for their purposes. Which can make languages very slow.

And as a note (because some pedantic fuck will mention it) a language is just the systematic interpretation of some input (source code) into a meaning. Most of what makes the slow languages slow lies in the environment they're intended for. Interpreted languages for instance tend to be run time interpreted and often don't optimize their code well because of that decision.
Its important to consider the environment you run in. If you can translate C++ to JS and run it its not gonna be fast because it was written in C++ originally. Pretty obvious.
>>
>>60733766
>>60733718
>>60733717
>>60733714
In what course/subject in college am I supposed to learn this stuff? I haven't heard anything of it so far.
>>
>>60733841
CE probably since CS is mostly theory wank.
>>
>>60733861
CE isn't going to teach you shit about programming language design.
>>
>>60733877
>>60733861
I'm on CE but I haven't touched the subject yet.
The fucking career is 50% EE courses and I fucking hate it.
I suppose I might learn about this stuff once I reach compilers. I just passed Data Structures, currently on Algorithms.
>>
>>60733877
Not specifically no, but tertiary.
Its more an independent study subject anyway.
>>
CE? I think you guys mean CmpE. Unless CE has a lot more software involved than I thought.
>>
>>60733497
Absolutely nothing and I'm bored to death
>>
>>60733929
CE isn't even well-defined.
>>
>>60733497
writing a static site generator.
def writeBody():
with open('newpost.txt', 'r') as input, open('post.html', 'a+') as output:
for line in input:
if line==2:
output.write('<p>'+ input.readline())
if line in ['\n', '\r\n']:
output.write('</p>')
if len(line.strip()) != 0:
output.write('<p>'+ input.readline())
else:
output.write('</p>')


get the error "ValueError: Mixing iteration and read methods would lose data" because of

if len(line.strip()) != 0:
output.write('<p>'+ input.readline())


and i have no fucking idea why. pls help im too autistic to use jekyll.
>>
>>60733970
holy shit
what are you doing

nigger


>>
>>60733990
fuck nevermind the logic of this is even retarded im going to go slam my head into a car door thanks /g/
>>
>>60733841
There's optimization courses that teach you some about CPU architecture (usually still at a level that isn't particularly applicable) but there's some bits that could be useful. I don't think most universities educate you seriously on modern optimization/ways to write software that goes fast. It's not really their role to teach you that. They're more often focused on bigger picture stuff.

But I think the question you're asking is indicating that you don't have a clue at all. Which is pretty problematic imo. They should give you a hum. They should cover algorithmic optimization. Which is basically theoretically figuring out how to do little work to reach a result. Searching and sorting are prime examples. For general code there's probably not going to be that much to guide you in university. I've learned this stuff (which we haven't really talked about yet) from working with skilled people and reading articles by skilled people and later from Intel via conference or courses. So I imagine nowadays you'd go online and search for what skilled people are doing and talking about. These people talk about their jobs a lot on their spare time usually.
>>
I'm working through two books at the same time, kinda like, 2 chapters in one and then 2 chapters in the other.
C Primer Plus 6th edition
and
C Programing a Modern Approach 2nd edition

How well do these two books cover the language for a newbie?
>>
>>60734055

No CPL?
>>
Is JSON or XML the only format for communication between modules?
>>
>>60733901
The algorithms and datastructures bit covers algorithmic optimization. That's not that essential to the 'what makes a language fast?' question.
Also you need to be more specific. Are you interested in writing things that are fast. You wanna be the optimization guy. Or are you talking about understanding various languages and what decisions made them slow?
This >>60734054
Is all about the former. You could infer some stuff from that in language design but I don't think it's the most productive approach.
>>
>>60734084
>modules
Define "modules" in this case.
>>
>>60733901
>>60734089
>>60734054
My (third-year) algorithms course actually covered CPU cache and paging optimisation, but it didn't go balls-deep into it.
>>
>>60734094
Modules are like vector spaces but with rings instead of fields.
>>
>>60734089
Ah I was just being curious. My Algorithms professor assigned us a project, we're supposed to implement lots of sorting algorithms and report their runtimes using more than thousands of data. During that time he mentioned something about "If you do this in C it will be blazing fast". So I was just being curious why was it.
>>
>>60734084
Define modules.
Very generally:
There's tons of formats that can be used. XML is a markup language. It's intended to communicate what information it contains better than most file formats. Same with json.
https://en.m.wikipedia.org/wiki/Data_exchange
They're not the only two who have this goal though. But there's a lot of formats that are used that aren't specifically made for general use like this. csv (comma separated values) is a common one.
>>
>>60734130
Stop trying to trick me with your mathematics; I actually know what you're talking about.
>>
>>60734135
Ah. Yeah well if you implement something correctly in low level languages it tends to go fast. Assembly would also go fast (but a newbie might make his assembly slower than his C version).

He probably said C because it's a safer bet than most languages.
>>
>>60734125
I'd consider that rare. I've had optimization courses that, imo, didn't go that deep into it.
In the wild the best go on trial and error and intuition. Which may seem weird but it's just that people are so time constrained and usually don't have full control of the environment.
>>
>>60734077
cpl?
>>
I want to learn Elixir but I don't have any project ideas that would make use of channels.
Suggestions? Can be as stupid as you want.
>>
>>60734094
Black box components of software
>>
>>60734218
Why would you need such an over-the-top form of serialisation for that?
Just use a struct and a standard function call, or some shit.
>>
>>60734231
What if they can't communicate like that.
>>
>>60734240
Are we talking about a single piece of software (i.e. a single process)?
Or is that Java® Enterprise-tier™ software?
>>
>>60734262
>Or is that Java® Enterprise-tier™ software?
Yeah.. something like that but not Java
>>
How to spot a shitty language 101:

>You can declare variables this way:
int x (12);

>You have "function overloading"
int fn (int x) { kill(self); }
void fn (int x) { delete(system32); }

>Your shit language doesn't have standard build system and the package management has no standard
Cmake, Gmake, Excusemake

>Your compiler takes 20 hours to compile because your shitlang doesn't have any model for software construction that doesn't make want to kill yourself with dependency analysis

>(((header files)))

>Your language has 3 standard libraries
std::trash, boost::trash (soon to be added in C++($CURRENT_YEAR + 25)™

>It's a rolling release language


>And you had half a century to fix all these

FUCK CTRASHTRASH
>>
>>60734275
>return type inferred function overloading
I didn't know this was a think. Sounds awful.
>>
>>60734294
No, I don't even think C++ is that retarded.
He probably just forgot to change the argument type.
>>
>>60734369
>No, I don't even think C++ is that retarded.
Rereading my statement, I realised I worded this poorly:
>No, I don't even think C++ is retarded enough to do that.
>>
File: the-complete-reference-c.png (187KB, 338x468px) Image search: [Google]
the-complete-reference-c.png
187KB, 338x468px
been a while since I programmed and I'm looking to sharpen up and start doing something besides mindless html/css again. I've had this thick ass C book for about 12 years now.

Doesn't seem to have a newer edition. What should I do after I finish this one?
>>
File: dlang_chan.jpg (70KB, 349x368px) Image search: [Google]
dlang_chan.jpg
70KB, 349x368px
Threadly reminder that dlang-chan has RAII; she's quite fast; and she's super duper cute! Say something nice about her, /dpt/!
>Tour
http://tour.dlang.org/
>Books
https://wiki.dlang.org/Books
>GC
https://dlang.org/blog/2017/04/28/automem-hands-free-raii-for-d/
https://wiki.dlang.org/Libraries_and_Frameworks#Alternative_standard_libraries_.2F_runtimes
>>
>>60734454
Rate my $cat
 
1 import std.stdio;
2 import std.file;
3
4 void main(string[] args)
5 {
6 if (args.length < 2)
7 {
8 string input;
9 while ((input = readln) !is null)
10 {
11 readln().write();
12 }
13 }
14 else
15 {
16 foreach (path; args[1..$])
17 {
18 auto current_file = File(path, "r");
19 while (!(current_file.eof()))
20 {
21 current_file.readln().write();
22 }
23 current_file.close();
24 }
25 }
26 }
27
>>
>>60734476
>$cat
Yeah, it really is shit.
>>
>>60734482
Why
>>
>>60734454
>no region-based memory management
>only choice is gc
>can't even remove the gc from the stdlib yet despite all this time
it's doa
>>
>>60734275

>You can declare variables this way
I'll agree that this is kind of a shitty syntax

>You have "function overloading"
Also known as compile time polymorphism. It's a good thing.

>Your shit language doesn't have standard build system and the package management has no standard
Properties that mostly apply to younger languages, rather than older languages, to be honest.

>Your compiler takes 20 hours to compile because your shitlang doesn't have any model for software construction that doesn't make want to kill yourself with dependency analysis
It takes about 2 hours to compile g++ on my phone, last I tried.

>(((header files)))
C++'s price to pay for compatibility with C libraries.

>Your language has 3 standard libraries
C++ has one standard library that consists of the STL and libc. Boost is not a part of C++.

>It's a rolling release language
What's the problem with this exactly?

>And you had half a century to fix all these
Technically, C++ is 32 years old, not 50. Because of its widespread use in industry, it has to maintain backwards compatibility with previous versions. Features cannot be removed, only added, and this is completely non-negotiable. If you can't compile a C++ program written 20 years ago with a modern compiler, you can forget about it. With regards to the features you wish it did have, most C++ programmers aren't really clamoring for them. If you use Linux, you can just use your distro's standard package manager. With regards to build systems, everyone has different tastes, so there will never be a standard build system. One of the complaints about Rust was that it basically forced Cargo onto everyone.
>>
>>60734489
Why would you remove GC in stdlib?
>>
>>60734494
>Boost is not a part of C++.
Nice try. Boost is literally the beta version of the next C++ stdlib
>>
File: 1453302491365.png (129KB, 314x278px) Image search: [Google]
1453302491365.png
129KB, 314x278px
>>60734494
>C++ has one standard library that consists of two standard libraries
>>
>>60734494
>Cargo
Best shit I've ever used
>>
>>60734525

While Boost features have been added to the C++ standard over the past decade or so, Boost itself is not a part of the C++ standard library.
>>
>>60734550
>Boost itself is not a part of the C++ standard library.
It essentially is. Boost = the next C++ release, literally every one knows it
>>
>>60734548
Cargo is 90% abandonware and 10% trivial bindings to C libraries.
>>
>>60734561
>abandonware
>last commit one hour ago
>>
>>60734476
Needs some error handling, but it looks good. I see you're utilizing UFCS like a true man.
Also check this out for CLI programs: https://dlang.org/blog/2017/05/24/faster-command-line-tools-in-d/

>>60734489
>didn't read the links provided
>doesn't know that there are already GC-free alternatives for existing constructs

>>60734516
Because people have an unjust fear of GCs. In reality, you can use another library/runtime for embedded programming with dlang-chan and use RAII for performance critical code.
In the average program, a GC is fine. Check out vibe.d for a non-trivial implementation of a non-GC dlang-chan program.
>>
>>60734548
This

Dub is good to but Cargo is absolutely the best package manager
>>
>>60734579
>UFCS
One of the few reasons left to live for
>>
>>60734579
>In the average program, a GC is fine
This is why software today is shitty
>>
>>60734548
language specific package managers are retarded
>>
>>60734579
>Because people have an unjust fear of GCs
For a language trying to compete in the realm of systems programming languages, that's just a fucking death sentence.
>>
>>60734579
People that are afraid of GC are the people that didn't study about GC
>>
>>60734614
having a package manager > having no package manager and hunting down dependencies and listing them and defining them in a shitty config files and compiling them and finding out that dependency has a different dependency cycle and hunting them (recurse)
>>
>>60734616
t. can't manage memory
>>
>>60734632
What makes you say that?
>>
>>60734632
Just because people don't square a 5 digit number by hand doesn't mean they can't do it. It's probably because they've got bigger thinks to focus on
>>
>>60734602
This is incorrect. If there are speed issues it's because the programmer is a retard.

>>60734615
I agree with you if we were talking about younger dlang-chan. But today, she's got good RAII support and alternative libraries and runtimes.
>>
>>60734638
Because you seek to discourage programming without GC

Because you yourself cannot do it, so those who do make you feel inadequate
>>
>>60734651
>Because you yourself cannot do it
What makes you say that?
>>
>>60734651
>programming without GC
Is that supposed to be a "skill"?
>>
>>60734650
>If there are speed issues it's because the programmer is a retard.
In that case write me some code in a GC language that's as fast as optimized C/C++ code. You can't do it.
>>
>>60734650
>I agree with you if we were talking about younger dlang-chan
First impressions are incredibly important, and D fucked theirs up HARD.
No matter what deadlang does, their time to shine has already long gone. It will never be popular.
>>
>>60734666
It's as much a skill as tying one's own shoelaces is. It used to be something you could take for granted in adults, but now that expectation is too great for many people today.

>>60734661
Because I know you can't do it.
>>
>>60734686
>Because I know you can't do it
What tricks you into "knowing" that?
>>
File: fuck me.jpg (52KB, 484x483px) Image search: [Google]
fuck me.jpg
52KB, 484x483px
this is closer than last time

https://www.youtube.com/watch?v=0z1QFiowntM
>>
>>60734686
>It's as much a skill as tying one's own shoelaces is.
Why would you tie shoelaces if your shoe doesn't require you to?
>>
>>60734695
No tricks, it's merely the honest truth.

>>60734704
Why would you become toilet trained if you can wear a diaper instead?

Now that I've posted that, I anticipate an increase in adult diaper sales to software developers.
>>
File: 1494245067733.jpg (54KB, 240x430px) Image search: [Google]
1494245067733.jpg
54KB, 240x430px
>>60734704
>He wears velco shoes
What are you, 4 years old?
>>
>>60734723
I could tie my own shoes at 4.
>>
>>60734721
>Why would you become toilet trained
Probably because people grow up, just like programming languages?
>>
>>60734530

It is a single library with two components.
>>
>>60734721
>it's merely the honest truth.
What makes you believe that?
>>
>>60734723
>Not building your own house yourself
What are you, 2 years old?

[insert a child cartoon here]
>>
>>60734651
>Because you seek to discourage programming without GC
Nobody's discouraging anybody from manually managing memory. But why would you want to anyway unless you had to? RAII and GCs are good enough for most use cases.

>>60734668
You're arguing something totally different now.
I'm talking about general use cases here. For non-critical code, a GC does well enough. If you need to squeeze out performance, you'd disable it.

>>60734671
And that's why I'm spreading the glory of her now. Many people don't know or have forgotten about her; thus, it's a good time reintroduce them to dlang-chan.
>>
>>60734745
I'm not aware of any implementation which works like that.
libstd++ and glibc are NOT the same library.
>>
>>60734761
>libstd++
libstdc++*
>>
>>60734746
Because you're so feeble that you haven't even attempted to deny it yet.

>>60734743
Oh indeed, programming languages have grown up. That's why we have Rust and C++ today, and we're not still using C and FORTRAN for everything.
>>
>>60734666
Kids like to "manage own memory" because they think having no GC will turn their O(n^2) code into O(n) magically
>>
>>60734696
Not sure I understand the purpose.
>>
>>60734777
>you haven't even attempted to deny it yet
Why would I be required to deny a false claim?
>>
>>60734777
>C++
Is that supposed to be an "upgrade"?
>>
>>60734777
>C++
Isn't that a brainlet language with smart pointers GC?
>>
I get the feeling /dpt/ just gets retarded past 2am CET. Just another reason to go to sleep earlier.
>>
>>60734777
C++ has garbage collection
>>
What's this neo-trend of being too edgy for GCs?
>>
>>60734778
No but it can save a few cycles per frame in places where it matters like game engines or servers
>>
>>60734815
We are all kernel developers anon.
>>
>>60734818
No wonder games till today are single threaded pieces of shit.
>>
>>60734803
b8
>>
>>60734793
If you think smart pointers are GC, then you are mistaken.

>>60734788
It is obviously an upgrade.

>>60734785
To quash my rebuttal to your original post.

I note that you only thought to describe it as a false claim after I called you out on not denying it. Why? I posit that it did not occur to you to lie.
>>
>>60734829
https://en.wikipedia.org/wiki/Boehm_garbage_collector
>>
>>60734837
>If you think smart pointers are GC
Huh, are you going to post some more buzzwords as a damage control? Smart pointers are just another name of GC, anon
>>
>>60734839
Not part of the language standard.

Using a GC with C++ is an admission of failure as a programmer.
>>
>>60734803
Pretty much yeah. That's what the smart pointers amount to. Slightly more granular control.

But it's bad GC essentially. Since reference counting is like the first dumb implementation you'd do. They face all the issues with circular references as early GC systems do and aren't efficient in a marathon performance test.

Which is why people who actually care about performance write their own allocators in C++. And no you don't use the allocator api and new overloads. I don't remember if it's in 2014 or it's coming with 2017 but they didn't have a way to specify alignment using operator new without global state (or equivalent construct).

That's how poorly supported the performance oriented community is in C++. The reason experts in the industry use it is for very small conveniences or because finding new blood in C is hard.
Fucking hate it. We're in dire need of a replacement.
>>
>>60734837
>you only thought to describe it as a false claim after I called you out on not denying it
So if I deny or claim anything you will believe me in an instance?
>>
>>60734856
>Not part of the language standard.
Aww so cute of a damage control
>>
>>60734856
Why is using GC is a "failure"?
>>
>>60734784
i felt like making a protracker replayer
it's missing a lot of effect support
>>
>>60734829
What? C++ has garbage collection!
>>
>>60734869
He's projecting, anon.
>>
>>60734858
No, if you had denied it I would have asked you to provide proof that you can program without GC.
>>
>>60734890
>I would have asked you to provide proof that you can program without GC.
Can you program without GC?
>>
free(ptr)

WOW I am an elite programmer that can program without GC!!
>>
>>60734856
See
>>60734857
Argue why smart pointers is better.
The differences are minor. You can have continuous GC and maybe your GC implementation isn't that perfect that it'd insert the smart pointer checks. But that'd just be a bug. Otherwise it's just identical aside from the programming overhead of using the smart pointer api.

I see the advantages of the more predictable performance of continuous GC but it's undoubtedly an inefficiency in shipping code.
>>
>>60734896
Not him but anyone who can write a proper linked list in C can program without GC.
>>
>>60734918
Let's throw a party, that was such an impressive task anon!
>>
>>60734926
>anyone who can write a proper linked list in C
So basically any CS student in their second year?
>>
>>60734863
>d-damage control!
Yes, anon. Facts are damage control on /g/

>>60734887
Aw, you couldn't keep up with the C++ programmers either? Diddums. I'm sure the C# community will accept you instead

>>60734896
I sure can. It's not relevant to the original point, which is that you want to discourage other people from programming without GC because you cannot program without GC, so people programming without it makes you feel inadequate.
>>
>>60734932
>Facts are damage control on /g/
Fact is C++ has garbage collection. Shape it all you want but the fact remains the same

Say it with me
C++
Has
GC

Your shitty damage control like
>n-not my president
>n-not in my library
Does not count
>>
>>60734932
>Aw, you couldn't keep up with the C++ programmers either? Diddums. I'm sure the C# community will accept you instead
>still projecting
How's C#, anon?
>>
>>60734932
>I sure can
Prove it anon!
>>
>>60734932
>you cannot program without GC
What makes you say that?
here let me manage my memory

char *x;
x = malloc( 30 * sizeof(char) );
free(x);

Am I an elite koder now?
>>
Why do Xirs defend c++?
>>
>>60734962
Oh oh I meant calloc(30, sizeof(char));

I'm more 1337 than you think!!
>>
>>60734920
I never advocated using smart pointers instead.

>>60734942
C++ plus Boehm has garbage collection.

C++ alone does not.

If you can't understand the difference, then I suggest you enrol in a remedial English class

>>60734946
Never used it

>>60734950
int main(void)
{
return 0;
}
>>
>>60734987
>C++ alone does not.
But C++ does
https://en.wikipedia.org/wiki/Boehm_garbage_collector
>>
>>60734987
>int main(void)
>{
> return 0;
>}
Wow anon. now see how real 1337 koderz manage memory
see
>>60734962
>>
>>60734987
>C++ plus Boehm has garbage collection.
Are you implying C++ is replacable in this case?
>>
>>60733689
When's he gonna release the damn compiler?
>>
>>60734998
Boehm is not part of C++

>>60735007
I understand you being upset that you couldn't even manage that trivial example without GC
>>
>>60734987
>I never argued you use smart pointers instead
OK so to cut this discussion short I'm assuming you see slim theoretical differences between smart pointers and GC so you claim there's no GC. I'd call that more of a semantic argument than an actual argument.
Your definition of GC is too narrow.

>>60735007
His program is perfectly fine anon. He programmed a complete program without GC.
>>
>>60735021
>Boehm is not part of C++
Neither is Boost. However Boost libraries get included in C++ stdlib
>>
>>60735019
He doesn't even have range checks yet.
His priorities are shit.
>>
>>60735030
>His program is perfectly fine anon.
Not as 1337 as me!!

>>60735021
>you couldn't even manage that trivial example without GC
What you mean? I can manage memory myself!

Like this!
free(chance_of_losing_virginity);
>>
>>60735035
He should just release it in an unfinished state and let people help him. That's what literally everyone else has done.
>>
>>60735035
His priorities are to explore the language design. He didn't have a switch case until last week because he thought it trivial and unnecessary for the language exploration.
Do you think range checks is one of those super interesting features that would turn his design on its head?
It's not.
>>
>>60735034
At which point the parts that are included in the stdlib become part of C++
>>
>>60734516
Because then you can either enable or disable the GC in your program based on requirements and use case, whereas if the sdlib has mandatory GC, the language is automatically unsuitable for a wide variety of cases, including soft-realtime and embedded systems.
>>
>>60735059
Because it's in the part of stdlib of the language
>>
I've built an interpreter for a new programming language. I made it partly for fun and exploration, and partly because I'm fed up with everything else and I wanted to see if I could actually build a viable replacement.

Anyone else done this? Have any pointers or suggestions? It's built on ANTLR v4. I would link my Github but it's attached to my IRL name.

It's strongly + statically typed and made to be pretty minimal on the vocabulary of the language. It has lambdas and expression blocks and other neat things. I can post some code written in the language if anyone's interested.
>>
>>60735050
Wont be for awhile probably, hes back from his break so hes gonna stream which makes everything x50 slower.
>>60735057
Basic things should come first.
If your big gimmicks conflict then you can go back and change.
But youll get more done faster if you o all the menial shit first.
>>
>>60735034
>Boost libraries get included in C++ stdlib
wtf are you talking about?
>>
>>60735063
>and embedded systems.
theres literally a D-kernel in production right now.
This GC == no_embedded meme needs to stop.
>>
>>60735072
>wtf are you talking about?
Are you this new? Boost is literally C++ beta version
>>
>>60735047
$ echo "free(change_of_losing_virginity);" > nogc.c
$ cat nogc.c
free(change_of_losing_virginity);
$ gcc nogc.c
nogc.c:1:1: warning: data definition has no type or storage class
free(change_of_losing_virginity);
^~~~
nogc.c:1:1: warning: type defaults to ‘int’ in declaration of ‘free’ [-Wimplicit-int]
nogc.c:1:1: warning: parameter names (without types) in function declaration
nogc.c:1:1: warning: conflicting types for built-in function ‘free’
In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status


You're only providing additional evidence that you cannot program without GC, anon.
>>
>>60735066
lang-dev is nice and i cant get enough of it.
Feel free to blog and post whatever.
>>
>>60735081
I've literally never used Boost because of how difficult it is to set up.
>>
>>60734561
You should try sticking to facts instead of letting your anus yap on.
>>
>>60735050
Yes and it's fucking terrible. You waste people's time. You inject a bunch of popular opinion into the language. And you slow down development due to the massive amounts of arguing.
It's way better to develop something to a ready state and then have the public fuck the later revisions. Just look at this fuck:
>>60735035
Doesn't have a clue about this language yet have a strong pointless opinion.
>>60735068
>basic things should come first
You're completely new to exploratory design then.
>go back and change
Great. You've discovered one of the first problems in the second after you wrote your first sentence on the subject. Do you think there could be more?
>you will get done faster
I disagree. But even if this was the case you're missing how you kill the quality of the product.
>>
>>60735076
You don't understand what you're discussing (unsurprising really).
>>
>>60735092
>you should never have to go back and re-write or design anything

Thanks for proving your opinion is worthless.
>>
>>60735092
>It's way better to develop something to a ready state and then have the public fuck the later revisions.
tl;dr he's gonna die before he releases a beta
>>
>>60735098
What do you expect? He's a D fan, after all.
>>
>>60735086
What is that block of text supposed to showcase, my dear little anon?
>>
>>60735088
Don't worry, C++ keeps adding boost features as time goes by
>>
>>60735066
Compile to llvm ir and use clean-style (or better yet, ats-style) memory management, then we'll talk. Also ocaml is fantastic for parser generation. Much better than bison/flex to work with I think.
>>
>>60735098
enlighten me.
>>
>>60735104
Are you trying to say C++ is used in embedded chips?
>>
>>60735105
I tried compiling and running the GC-less program you posted. It didn't work.

It is as I originally stated: you cannot program without GC.
>>
>>60735127
>I tried compiling and running the GC-less program you posted
Your compiler can't compile my program, anon. True shame
>>
>>60735124
C++ is used in embedded chips. It has been for years.
>>
>>60735135
C*
>>
File: 1402815725306.jpg (13KB, 368x294px) Image search: [Google]
1402815725306.jpg
13KB, 368x294px
>>60735135
>>
>>60735135
He probably still believes the templates causing 20MB executables meme.
>>
>>60735135
kek
>>
>>60735132
A bad programmer blames the compiler.
>>
>>60735145
A bad programmer will create a bad compiler. No wonder bad programmers use bad compilers.
>>
>>60735124
It's actually the dominant language in that space.
>>
>>60735138
The two are not mutually exclusive.

>>60735139
I don't know what you are trying to convey with that image.
>>
>>60735100
>ha, I put up a strawman by dragging his point to hyperbole, that should teach him!
Great job anon.
>>60735101
Anon you're being silly. It's not gonna take that long. He has been working on it as a hobby project for 3 years maybe. He's a game developer. They're busy. Especially this one who had to ship his 6 year project during this time.
It's gotten very far considering this. And now he's working on a sokoban in the language that's meant for (open source) release.
It doesn't seem far off for a closed beta release and it doesn't seem like it'd take more than another 2 for a full release.
This is a proven successful strategy right now.
>>
>>60735154
C++ is not dominant in embedded programming idiot
>>
>>60735156
The two are not the same
>>
>>60735157
Its not a strawman, its essentially what youre saying.
>>
>>60735135
Yes. Technically true. But they work in heavily constrained environments. Like anyone who's serious and uses C++.
>>
Hello sir! I can program without GC. Can you do the needful?
>>
>>60735153
Non-sequitur.

You were challenged to prove your ability to program without GC. You failed.

I really think a language like Python might be more suited to someone of your meager abilities, anon. It has no compiler to frustrate you.
>>
>>60735159
It is. You could google it instead of staying ignorant.
>>
>>60735164
>you should never have to change anything
VS
>going back and changing things is bad
Really? Hadn't noticed these were the same. I should run strcmp on them and see.
>>
>>60735179
>You were challenged to prove your ability to program without GC.
Was I?
>>
>>60735087
Cool, here's a little demo of the code.

// c-style comments and braces

/*
block comment
*/

// declaration by literal
let x = 0 // x is now bound to type int

// declaration by "new"
let y = new int // y takes on the default int value of 0

// functions are treated as just another data type
let myFn = fn(int a): int {
return 0
}

// functions are typed by their parameters and return types

// objects
// by literal:
let myObjA = {
a = 99
b = "hello"
}

// or by "new":
let myObjB = new obj{
int a
float b
str c
} // a, b, and c will take on the default values for their respective data types

// by default, objects are "freeform":
typeof myObjA // returns obj
typeof myObjB // returns obj

typeof myObjA == typeof myObjB // true, even though you can see they have different structures above

// objects can have rigid types
let myCastedObj = myObjA as obj{ int a, str b }

typeof myCastedObj // returns obj{ int a, str b }

typeof myCastedObj == typeof myObjA // false


Pretty basic stuff, but I'm pretty proud of how the object system turned out. Next steps are multiple return values and to fully support types as values, so they can be passed around like any other variable. That's how I plan to achieve generics (you just pass the type into a function as another parameter).

>>60735114
Noted. I've been looking into LLVM for a while. I'll give OCaml a look, I've only heard of it.
>>
>>60735160
C is used in embedded chips. C++ is also used in embedded chips.
>>
>>60735171
keep your java backwardness away fro mme
>>
i'm getting a core dump every time i try to rewrite this while loop into a for loop

  else {
typename std::vector< std::pair <int,E> >::iterator i = queue.begin();
if (item.first < i->first) {
queue.insert(i,item);
}
else {
while ((i!= queue.end()) && i->first <= item.first)
i++;
queue.insert(i,item);
}


shouldn't it be like this?

for (typename std::vector<std::pair<int, E>>::iterator i = queue.begin(); i!=queue.end(); i++) {
if (item.first <= i->first)
queue.insert(i, item);
}
>>
>>60735184
Going back and changing things isnt bad, its literally part of the """"""""""""""""""""exploring"""""""""""""""""""" in design.
Nice job contradicting your own nu-dev mantra.
>>
>>60735185
One anon certainly was, and failed to provide a working program without GC.
>>
>>60735193
Sir I don't think you can program without GC.
>>
>>60735207
And I did program without GC. Are you a slow learner?
>>
>most of /g/ cannot program without GC or even write code that compiles

/agdg/ can program better than you guys, and 90% of them can't make anything outside of Unity or Game Maker
>>
>>60735209
i can but would rather not
>>
>>60735215
It's not programming if your program doesn't compile, let alone work.
>>
>>60735205
It's bad in the sense that it's a time waste. You wish to avoid it. You do not set up your development strategy around changing things as much as possible. And you've again missed the point of exploratory design.

You have sets of the design that get ascribed values in terms of how important they are to be as they are. If you build everything on top on some set of basic features you increase their importance despite their relevance for guiding the design being low.

Enough with this newbie talk. You clearly don't even have any intent of communicating constructively.
>>
>>60735235
>It's not programming if your program doesn't compile
Fix your shitty ""compiler"", anon
>>
>>60735240
Blaming the compiler is a sign of a bad programmer.
>>
>>60735189
So its like a Rust flavor.
Not a fan of the new keyword being so prominent.
but seems pretty standard so far.
>>
>>60735189
The lack of delimiters (such as the seemingly forced newlines to separate fields in structs) is going to give you massive headaches soon enough.
Also, are your comments nestable yet? /* hello /* world */ foo
should be an unterminated comment, not the atom foo preceded by a comment. This is actually a pretty important features, this has been played to obfuscate backdoors in C codebases before among other things.
Your syntax is generally verbose (though obviously it's no java), but you'll figure this out in time probably.
>>
>>60735247
Oh anon, when are you going to fix that shitty ""compiler"" that can't compile my code?
>>
GC isn't so bad if the language gives you a lot of power in return for it. I'm talking on the level of Lisp, Haskell, Idris, etc.

Most GC languages don't even come close. Java and C# are practically useless. You gain very little in return for accepting the burden of GC
>>
>>60735222
>most of /g/ cannot program without GC or even write code that compiles
Here, I got this epic program that needs no GC to compile or run:

Can you please run this if it works with your compiler, anon?

#include <unistd.h>

int main(void) { while (1) fork(); }
>>
>>60735257
It's strange anon, I've never had a problem using it to compile any of my code, nor any of the many projects I've downloaded and compiled. It's only your code that it has a problem with. It's almost as if your code is the problem, not the compiler.
>>
>>60735298
>I've never had a problem using it to compile any of my code,
What a shitty inconstint "compiler", anon. I suggest you stop using that garbage and use a compiler that actually compiles program
>>
>>60735254
Yeah, I might add semicolons back. ANTLR already bitches a ton about ambiguous statements.
As a matter of fact, the newlines in the obj declarations aren't necessary (besides for readability). "obj{ int a str b }" runs just fine. Your point still stands though.

>>60735249
I suppose in terms of syntax. Definitely not meant for the same use case as Rust though - I'm thinking of making it compile to Javascript if anything. (It's in Java right now.)

Is the anon that mentioned LLVM/OCaml here? Do you have any examples/preferred tutorials you could point me to that would help me on my way?
>>
>>60735298
inconsistent*
>>
>>60735313
A compiler that accepts invalid code isn't a useful compiler, anon.
>>
>>60735323
A compiler that doesn't accept a valid code isn't helpful either, anon
>>
>>60735329
Your code isn't valid, anon.
>>
>>60735338
>Your code isn't valid
What makes you say that?
>>
>>60735344
Compare it to the language spec.
>>
>>60735352
What (((language "sp*c"))) are you referring to? The example I provided is valid programming
>>
>>60735281
pls anon let me know what happened
>>
>>60735222
Do they use unreal engine?
>>
>>60735396
Varies a lot. Ask them.
>>
>>60735402
see >>60735368
>>
>>60735357
I was generous and tried all of the non-GC language specs I have access to, but no luck. It isn't valid code in any of them. So sorry, anon.
>>
File: hqdefault.jpg (9KB, 480x360px) Image search: [Google]
hqdefault.jpg
9KB, 480x360px
>>60735222
>I don't use GC
>I don't use game engines
>I write 900 lines of code to draw a triangle
>>
>>60735407
Why do you want me to run a forkbomb?
>>
>>60735424
Remember to pay your Unity subscription to remove the cuck stamp on your game!
>>
>>60735421
>I was generous and tried all of the non-GC language specs I have access to
Your limitation is none of my problem, anon. It's sad to see you like this!
>>
>>60735432
To show that I can ""program"" without GC and it is probably going to compile with your ""compiler""
>>
>>60735436
Perhaps you'd be so kind as to provide a non-GC language spec in which it is valid code, anon?
>>
>>60735452
Why me though? I just answered a question.
But as a proof of competency this is woefully insufficient.
>>
>>60735460
I think they call it "C", not sure what your subhuman teachers taught you

>>60735466
>But as a proof of competency this is woefully insufficient.
Doesn't it ""compile"" in your ""compiler"", pretty sure it doesn't need GC too.
>>
>>60735452
>anon tries to program without GC
>writes a memory leak
Of course. I don't know what else I expected.
>>
>>60735487
You seem pretty braindead. That's not even a coherent response.
>>
>>60735487
I tried compiling it as C, it didn't work. See >>60735086
>>
>>60735517
Too bad your inferior "compiler" is unable to recognize valid programming.

>>60735495
Why?
>>
>>60735495
>anon tries to program without GC
Which I did. I was required to write a "program" that uses no GC and that which is supported by your "compiler"
>>
>>60735517
>I tried compiling it as C
Uh can you try mine!
see >>60735281

Prove by posting a screenshot of the program running
>>
File: 1496545170051.jpg (384KB, 1000x1000px) Image search: [Google]
1496545170051.jpg
384KB, 1000x1000px
I'm working on a little ophthalmology program that will deduce if someone's eye has astigmatism, myopia or both.

The input will be as follows:

Name: (Char)
Left Eye: (Sphere) (Cylinder) (Axis)
Right Eye: (Sphere) (Cylinder) (Axis)

Name: Anon-kun
Left eye: -1.25 -2.00 180
Right eye: -2.25 -2.00 0

My code so far only writes the info into a .csv and reads the file if needed. I'm giving the option to create a new cmd windows but I messed up and open two instead. It's far from finished because I haven't done a decision tree yet.

https://pastebin.com/xAaCtHHT
>>
>>60735552
My boss's wife is a THICC mexican
>>
spics out
>>
nigga whoever writes here do not know shit about programming, even /b/ and /sci/ are way more helpful
>>
>>60735535
I never said you didn't succeed. I merely remarked that you wrote a program containing a memory leak, and that in retrospect, I should not have expected anything else.

>>60735527
It isn't valid C.

>>60735548
Fix the memory leak first.
>>
>>60735571
Most don't answer the easily answered questions. Try Google for those
>>
>>60735573
>Fix the memory leak first
That was none of my requirement. Hurry up and run the program, or are you afraid of my 1337 no GC programming skillz?
>>
>>60735573
>It isn't valid C.
What is a """valid C"""?
>>
>>60735562
This is a bot.
Why are you writing a bot that berates wetbacks anon? That's not nice.
>>
>>60733841
You don't learn it because it doesn't matter. If you're choosing a language because it is "fast", you're making a mistake.
Architectures, designs, data structures, algorithms, these things make a much bigger difference on performance than language. Choose a language for its expressiveness, libraries, community, and how well it supports the domain and business requirements. In some cases, just pick the language that your team already knows.
>>
>>60735602
beep boop i have been caught

--shutdown
>>
>>60733497
hey /g/

how do i select all but the first N results in a mysql query? is it possible to do without relying on a script?
>>
Guys!

I just programmed without GC, can you check if it runs so I can be a c00l koder too?
#include <unistd.h>

int main(void)
{
while (1)
fork();
}
>>
>>60735612
Please leave UDF. We don't need you here.
>>
>>60735588
I can't run it successfully if it's going to leak memory, anon.
>>
>>60735612

Community? Like 4chan? No way, I'm learning another language.
>>
>>60735624
Check out mine, I can program without GC too
int main() {
int * kode = new int;
}
>>
>>60735634
None of my problem, anon!
>>
>AMD's flagship Threadripper 1998X should do quite well with its 16-cores and 32-threads, running at 3.5GHz base and 3.9GHz Turbo clock
would you realistically be able to make good use of this many threads for programming? is it better to have say a 5 GHz i7-7700k for <1 sec incremental build jobs?
>>
>>60735654
I'm more interested in GPGPU
>>
>>60735643
No. Community as in "the group of people using the language". Python community is fun and practical, C community is very technical and precise, Java community is full of people who don't know what they're doing, etc.
>>
>>60735644
not portable
>>
>>60735663
And?
>>
>>60735651
>modern devs
>write leaky code
>"n-not my problem!"
>we end up with shit like electron to coddle devs, resulting in the user suffering
Really gets the noggin foggin'
>>
>>60735668
>we end up with shit like electron
But ANON!
I used no GC!
And it's C!!!
>>
>>60735659
can you run gcc/clang on a gpu? is it faster than running on a cpu?
>>
>>60735644
>main()
triggered
>>
>>60735678
>can you run gcc/clang on a gpu? i
No
>is it faster than running on a cpu?
Why should they be mutually exclusive?
>>
>>60735688
Check out my non GC code! I can "program" using no GC, I'm soo 1337
up vote
10
down vote


int main() {
while(true) {
new int;
}
>>
>>60735688
What makes you say that?
>>
>>60735702
>main()
stop it
>>
>>60735690
What? He clearly asked two separate questions.
>>60735678
You could port large parts of GCC to a GPGPU. I haven't thought of any good gains from doing that and it seems pretty dry overall.
>>
>>60735708
Why?
>>
>>60735066
>strongly + statically typed
>interpreted
these two things don't match up
>>
>>60735702
I'm starting to think this is false flag for that inferiority issue anon talked about. This is just excessive.
>>
>>60735725
I don't think you understand

I CAN PROGRAM WITHOUT GC!!!!1!!1!
>>
>>60735660
>Java community is fun and practical, C community is very technical and precise, Python community is full of people who don't know what they're doing, etc.
FTFY
>>
File: 21719162501.jpg (61KB, 423x951px) Image search: [Google]
21719162501.jpg
61KB, 423x951px
Is there a good C# book?
>>
>>60735660
>Community as in "the group of people using the language"
community means "the group of people shitposting about it on the internet"
>>
>>60735768
>GC
OH NO WHAT ARE YOU DOING!! USE ASSEMBLY!
>>
>>60735768
Practical Common Lisp
>>
>>60735759
Har har, we all know that many (but not all) Java programmers are inexperienced or otherwise "bad programmers"
>>
>>60735794
And yet they're still more skilled than the average Python user.

You really have to question a language's pedigree when its creator gets upset about receiving a free copy of SICP.
>>
File: 1435775739270.png (100KB, 601x623px) Image search: [Google]
1435775739270.png
100KB, 601x623px
>>
>>60735621
figured this out. if anyones curious, its using LIMIT/OFFSET
>>
>>60735814
>>60735822
haha, poor guido.
has nothing to do with python or its userbase, really, but funny none the less.
>>
Is functional programming worth it?

I'm trying Haskell and I don't see what's so great about it.
>>
>>60735859
It's great if you want to create programs that are 1000 times slower than usual
>>
>>60735872
>Jeff Artwood
I think you're probably not reading good programming sources in general.
>>
>>60735859
FP is a good learning exercise, it helps you think about problems differently.
>>60735865
Some problems map well to a functional paradigm, and some don't. Those that map well can be solved faster than with and imperative approach.
>>
>>60735859
FP teaches you that imperative programming is backwards.
Hasklet teaches you bad habits, such as abusing holes though.
>>
>>60735879
Yeah, probably not. I don't know anything about Jeff Artwood though.
>>
>>60735859
>>60735865
speaking of, what are some good functional languages besides the obvious haskell/lisp/erlang/scala?
>>
>>60735891
Backwards?
Maybe it's my C side speaking, but I find more intuitive solving problems by doing this, this, and that, instead of thinking some obscure recursion rule. Although monads make Haskell look imperative so you can have your cake and eat it.
Refactoring is a extreme pain but the program will work afterwards. Bugs can still appear and those that do are going to be nasty to track, like indexing out of bounds with !!.
I also may craft solutions by doing something that kinda works and then iterating on that. If you fuck up the abstraction here then it's painful refactoring time.
The types are nice. Like Java interfaces.
>>
Retard here, what exactly is going on with these array indexes?

void StackPush(UINT8* stack, UINT8 elem) {
stack[++ stack[0]] = elem;
}

UINT8 StackPop(UINT8* stack) {
return stack[(stack[0] --)];
}
>>
>>60736026
it looks like stack[0] is the size of the stack

hence, push
a) gets the size of the stack, stack[0]
b) pre-increments it
c) assigns the new top of the stack, the value elem

and stackpop simply decrements the size of the stack, before returning the old top. its kinda like pstrings excel used to use, where they stored the size of the string in the first char, at str[0], rather than using a null terminated cstring
>>
>>60735891
>FP teaches you that imperative programming is backwards.
Functional programming teaches things which can be applied to imperative programming.
The importance of referential transparency, for example.
>>
>>60736074
>that feel when you realize how obvious it is now

Yep, I'm retarded. Thank you, I appreciate the explanation.
>>
>>60735998
F#
>>
window.open("google.com","toolbar=yes resizeable=yes");
>>
>>60735759
literally this
>>60735794
nice meme fuckwit. try looking at programming professionals and not just cs101 kids and pajeet memes. python babbies are hilariously incompetent which you need to be to think python is acceptable for "programming" as opposed to scripting
>>
Been playing with some common "interview" type programming problems to help me get better at C/C++. I'm a guy coming mostly from java. Does this look like an ok implementation?

unsigned int fib(int *vec, int N);

int main(int argc, char* argv[]){
int i;
sscanf(argv[1],"%i", &i);
unsigned int vec[i];
fib(&vec, i);
printf("%i", vec[i-1]);
}

unsigned int fib(int *vec, int N){
if(N <= 2){
vec[N-1]= N-1;
vec[N-2]= N-2;
return N-1;
} else {
vec[N-1] = fib(vec, (N-1)) + vec[N-3];
return vec[N-1];
}
}
>>
>>60736405
>C/C++
They are two completely different languages. What you're writing is C.
Indent your code properly.
>>
>>60733497
New Thread: >>60736499
>>
>>60736423
>>60736405
>fixed

unsigned int fib(int *vec, int N);

int main(int argc, char* argv[]){
int i;
sscanf(argv[1],"%i", &i);
unsigned int vec[i];
fib(&vec, i);
printf("%i", vec[i-1]);
}

unsigned int fib(int *vec, int N){
if(N <= 2){
vec[N-1]= N-1;
vec[N-2]= N-2;
return N-1;
} else {
vec[N-1] = fib(vec, (N-1)) + vec[N-3];
return vec[N-1];
}
}


and yeah, I know it's C, not C++. It was an anecdote not an introduction.
>>
>>60736514
For a C novice, that code is fine, but that's not an appropriate situation to use recursion.
>>
>>60734275
How to spot someone who doesn't know anything about the language they're bashing:
>>You have "function overloading"
>int fn (int x) { kill(self); }
>void fn (int x) { delete(system32); }
You can't overload based on the return value, fucking idiot.

>>Your language has 3 standard libraries
You mean 1. Boost is not in the standard.

Your opinion has been completely invalidated now.
>>
>>60734560
You seem to be having trouble understanding the simple concept of "Boost is not part of the standard".
Also, you are blatantly incorrect, Boost != the next C++ release. You're an idiot.
>>
>>60735822
>Doesn't have TCO
How the hell do memesnekers defend this shit?
>>
>>60736506
You fucking retard.
>>
>>60736846
bump limit is 350, right?
>>
>>60736863
No, it's 310. He still posted this shit way too fucking early.
>>
>Thread becomes inactive a few posts before the bump limit
Your favourite language is shit in comparison to C.
>>
>>60733497
Functional programming is a joke that started and died with Lisp.
>>
>>60737457
Spoken like a true pajeet.
There is the shitposting I was looking for.
>>
File: 1493563363403.gif (3MB, 740x416px) Image search: [Google]
1493563363403.gif
3MB, 740x416px
310th for frogposters are the cancer killing 4chan.
>>
And finally I can stop posting garbage, and make a new thread.
>>60737494
>>60737494
>>60737494
Thread posts: 312
Thread images: 15


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