[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: 359
Thread images: 31

What are you working on, /g/?

Old thread: >>58775678
>>
File: 1474325315193.jpg (44KB, 636x616px) Image search: [Google]
1474325315193.jpg
44KB, 636x616px
Highly paid employed Haskell programmer reporting in
>>
>>58781558
Good for you anon, I hope I get a good job after I graduate university. Approximately what area do you live and in which field?
>>
File: 1477787653739.jpg (65KB, 600x1125px) Image search: [Google]
1477787653739.jpg
65KB, 600x1125px
>>58781539
>What are you working on, /g/?
Implementing a decision tree and have it use my sadpanda favorites to try to decide if any given gallery will suit my taste.
>>
>>58781558
Yeah, well, I'm reading ISA docs, eating hot dogs straight out of the package, drinking beer.
>>
File: 1453657295316.jpg (112KB, 1920x1080px) Image search: [Google]
1453657295316.jpg
112KB, 1920x1080px
>non-functional
>dys-functional
>>
What happened to the loli simulator that someone posted here or in /agdg/?
>>
>>58781611
He got a visit from the party van
>>
>>58781611
what do ya think
>>
>>58781625
>>58781621
The last reference I can find was a thread on /jp/ in 2012 where someone responded
"I reported you to the FBI"
>>
Are you as good at programing as you act?
>>
>>58781644
He's definitely posted since then
>>
>>58781644
He was posting last summer
>>
>>58781539
Learning x86-64 assembly by implementing some old school demoscene routines. (I wrote a C library to expose a 60hz planar frame buffer)
>>
Top 5 Meme Languages for meme programmers:
1. Python
2. Haskell
3. Rust
4. Go
5. Swift
>>
>>58781694
>hasklel not #1
>>
>>58781694
> 1. Python
(you)
>>
>>58781694
4 out of 5 of those (Go is bad) are good languages though.
>>
>>58781558
keep dreaming, meme faggot
>>
>>58781694
Top 5 languages for real programmers
C
Common Lisp
SML
Scheme
Chapel
>>
>>58781664
That's pretty nifty, what are you referencing for it?
>>
>>58781694
2 is excellent and 3 is probably not _that_ bad
5 i've heard is alright

the rest are trash
>>
>>58781729
You peed your pants again, grandpa.
>>
File: 1475332797992.jpg (171KB, 1280x1024px) Image search: [Google]
1475332797992.jpg
171KB, 1280x1024px
>>58781716
>Python
>not bad
>>
>>58781730
http://amr.abime.net/
https://en.wikipedia.org/wiki/List_of_disk_magazines
>>
>>58781539
Making a programming language:

https://github.com/FascinatedBox/lily
>>
>>58781774
HKTs?
>>
>>58781774
@very @nice
>>
File: 1479856923909.jpg (34KB, 292x479px) Image search: [Google]
1479856923909.jpg
34KB, 292x479px
>>58781774
>var @width =
>>
>>58781558
How's your fizzbuzz going son?
>>
>>58781789
Not yet
>>
>>58781664
>>58781765
Man, now I had the stupid idea of writing a MOD player in assembly.
See ya'll in couple of weeks.
>>
>>58781539
>What are you working on, /g/?
Someone else's Python program.

It juggles about 4 or 5 different dictionaries to perform modifications to a somewhat-repeat excel spreadsheet to turn it into another template. It's highly sensitive to spaces in the header, has shitty comments, is somewhat difficult to read because of the whitespace requirements for the multiple loops, and its dictionary "template" function doesn't work. I now understand why some people hate working with large Python programs and hate Python in general.
>>
File: B7S0djdCIAA6cIa.jpg (65KB, 506x662px) Image search: [Google]
B7S0djdCIAA6cIa.jpg
65KB, 506x662px
>>58781875
>>
>>58781875
I always get urges to write something in assembly, even though I had a horrible time just doing Fizzbuzz in it
Good luck senpai
>>
>>58781539
How much $$$ can I make by learning C?
whats a good language to know If I want to run my own server?
>>
>>58781934
>How much $$$ can I make by learning C?
over 50000 a day
>>
>>58781934
>whats a good language to know If I want to run my own server?
CCNA
>>
>>58781934
If you want $$$, learn to kode Python and Haskell. Those are the money making languages.
>>
>>58781934
>If I want to run my own server?
if you want to write your own server software for hobby use node.js (Language Javascript) is probably the best way to go.
If you want professional grade server software you write it in C++ (or C).

But the way you ask these questions makes me think that you have some misconceptions about where programming is necessary. You don't need to know programming to set up a webserver or FTP server or most kinds of servers.

So if you're more specific about your actual goals someone could help you more.
>>
If I want information about new graphics technology where do I go? Where do the top tier graphics professionals hang out/post their stuff? Is it all scattered on random blog posts from employees at companies like DICE?
>>
>>58781966
>kode
Go back to school illiterete faggot
>>
File: 1483889496739.png (19KB, 500x590px) Image search: [Google]
1483889496739.png
19KB, 500x590px
>tfw to smart to be a code monkey aka programmer
>>
>>58782013
>image shows a 4D-2D projection of a cube brain
>it's just a projection
>posters brain is actually just a plane
>>
Are graphics libraries like SDL an OpenGL written from near scratch for every platform they run on?

And if your game supports DirectX and OpenGL, how does that work? Is it just a literal ton of if(using openGL) do this else do this? Like all the game rendering is basically written twice and it just picks which one to use?
>>
>>58782027
>OpenGL
A graphics API that interacts with the graphics driver.
>SDL
SDL does opengl calls

Basically everything you interface with is stuff written to a spec which driver people implement.

So basically view it
SDL calls opengl which calls the graphics driver which does stuff on the GPU.
>>
>>58782027
>And if your game supports DirectX and OpenGL, how does that work? Is it just a literal ton of if(using openGL) do this else do this? Like all the game rendering is basically written twice and it just picks which one to use?

SDL has two implementations; one for Windows where it calls DirectX, and another where it calls OpenGL for Linux, and what not.
>>
>>58782027
>>58782057
and graphics drives are a mountain of hacks, a figurative hellscape of conditional logic, down to, in the case of some AAA games, hot patching a game's renderer completely.
>>
>>58782057
So OpenGL never has to interface with the OS, just the graphics driver? Meaning the OpenGLs source code should compile anywhere that has a graphics driver supporting OpenGL, yes?

I guess that makes more sense than what I was thinking.
>>
>>58782026
Cubes are 3D.
>>
>>58782087
>So OpenGL never has to interface with the OS, just the graphics driver? Meaning the OpenGLs source code should compile anywhere that has a graphics driver supporting OpenGL, yes?
Yes and no, you have to get the address of opengl functions past version 2.0 or something like that, but if you use something like glew, that does this for you, then yes, as long as your driver supports the given version of opengl, your good to go.
>>
>>58782080
Yeah but for a game like World of Warcraft, you can all -opengl to its command line arguments to force it to run in opengl instead of directx. So does everyline of code in the game that involves drawing something to the screen just have a bunch of conditionals for which version you're running?
>>
>>58782013
>code monkey = programming
>>
>>58782087
theoretically, yes, in practice, no,
>>
>>58782113
No, it compiles different sets of files.
>>
>>58782113
void (*draw)() = is_opengl ? opengl_draw : is_directx ? directx_draw : software_draw;
>>
>>58782087
The driver is a OS integrated module essentially. So your interaction with the OS is really your interaction with the driver.
Though there's all kinds of types of drivers and OSs.

Very often graphics is one of those things that are more raw than virtual on the OS side.
>>
>>58782148
>function pointers
Oh boy. Answers my question though, thank you
>>
>>58782163
>Answers my question though, thank you
he did
>>
>>58782176
That's what I said
>>
>>58782181
sorry, I miss read, my bad.
>>
>>58782191
It's okay senpai
>>
>>58782195
>>
>>58782110

That's a hypercube.
>>
>>58781648
There are a few decent people here, but the vast majority is good at making simple functions and that's about it; rather than actually developing full applications.
>>
>>58781648
much much better
>>
>>58781558
>The stories and information posted here are artistic works of fiction and falsehood. Only a fool would take anything posted here as fact.
>>
>>58782303
That's what I was getting at, yes.
>>
>>58782163
Obviously that's a gross simplification of actual big time video game titles, but that's the basic gist of it.
But the principle is you want abstract away as much of the graphics API dependant logic as possible, and only deal with it in a single specified contact point between your software and the driver.
>>
>put butt plug in
>chug remaining can of ginger ale
>attach throat gag
>turn lights off
>load youtube 'programming music' playlist
wew, time to code some java!
>>
>>58782474
it's friday baby
>>
File: Cprogram.png (107KB, 792x1023px) Image search: [Google]
Cprogram.png
107KB, 792x1023px
How long did it take you to realize that this book was not written for absolute beginners?
>>
>>58782511
I have not reached that conclusion yet.
>>
>>58782511
It never was said to be one.
>>
>>58782511
It says really early on.
Doesn't matter though. It's assuming you know very little.
>>
>>58782511
>not made for absolute beginners
you have to be able to read english, yes
>>
>>58782008
Nobody?
Shit.
I guess I'l make a big list of employee names and write a web crawler or something.
>>
>>58781539
WHICH ONE DO I USE?
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
ld byte r0,r1
ld r0,r1,1
>>
>>58782511
2 wks.
Was 15 when bought.
Understood a shit.
>>
>>58782618
Just pick one, what difference will it make?
>>
all of you are amateour junior pajeets
>>
>>58782648
i can't choose, i need your opinion
>>
File: do_I_look_smart.png (19KB, 1024x768px) Image search: [Google]
do_I_look_smart.png
19KB, 1024x768px
Found the 0.01 version of Linux, so I'm looking through that
>>
how do you get ideas for a new project? I just want to make something to practice my programming but I can't fucking think of anything
>>
why does writing C with a dark IDE background feel so wrong?
>>
>>58781539
Software engineer reporting in
Actually working on backend development in Go
We're building up an analytics service that uses raw geolocation data to do users profilation and such
It's actually pretty neat, even though I was worried about privacy at first

Geolocation data comes from an SDK for Android/iOS that my company developed for quite a while now, it has some unique perks like motion recognition, extreme battery saving while delivering insanely accurate positions

Cons: they don't pay me enough for the work I do
>>
>>58782667
>Yeah, yeah it's ugly
So this is when everything went so wrong
>>
>>58782667
When Linus was 22 he released first version Linux...
What big projects has /g/ released when they were 22
>>
>>58782658
i don't usually make jokes of this, but,
that's some weapons grade autism
>>
>>58782718
When I was 20 I made a chatroom app that could send messages one way on the same network
>>
>>58782718
ever heard of Windows?
>>
>>58782511
I was a beginner when I studied it (first year CS) and understood it perfectly.
No bullshits, straight to the point.
No one makes books so good, no more (i.e. I tried to read C++11 reference manual from Bjarne, bloody hell what a piece of garbage).

And, most importantly, I'm not a genius, at all.
So, the problem is you, probably.
>>
>>58782759
Fuck off Gates nobody likes you.
>>
File: 1486113391254.jpg (125KB, 800x720px) Image search: [Google]
1486113391254.jpg
125KB, 800x720px
Is C++ canonically the strongest language?
>>
>>58782775
Bjarne writes terrible books.
>>
>>58782806
no
>>
>>58782806
Possibly, but I have a feeling Rust might give it a run for its money.
>>
>>58782812
To his credit he's not writing in his native language.
>>
>>58782806
Nope.
But it's the most flexible, while being the most terrible (design-wise) language out there.

80% of programs written in C++ do use 5% of its potential, because no one can actually write C++ code.

That's why C++11/14 exists :)
>>
>>58782012
He was being sarcastic.
>>
>>58782775
>>58782812
Are bjarnes books really that bad? I'm pretty advanced in java, I've done a lot with it and been using it for almost a decade, So I went through k&r's C book a couple times to drill down the basics and was thinking of getting one of bjarnes c++ books to further some points. Should I not waste my money then? What's a good c++ book for someone with pretty extensive knowledge already?
>>
>>58782826
It's not that.
He's too fucking pedantic.
>>
>>58781934
https://blog.bradfieldcs.com/in-2017-learn-every-language-59b11f68eee
>>
>>58782806
No it's OCaml.
>>
>>58782865
>>This isn’t actually about becoming competent with 500+ languages. It’s about understanding the common paradigms and implementation patterns so as to be confidently language agnostic
>sensationalist title despite this
>teaches computer science
I don't see why he even feels he is qualified to speak on the subject.
>>
>>58782859
they're fine in my opinion.
obviously it depends how you personally learn.
grab a copy off genesis and skim through the few couple first chapters and see if you like it.
>>
>>58782894
That's a weird way of spelling Erlang
>>
>>58782859
I was "raised" with C and OCaml, they gave us good programming basics right away
As such, the only C++ I needed to learn was idiomatic C++ or "Effective C++"

I don't really know if there's a really good beginner/intermediate C++ book.

And do expect something completely different from Java.
OOP is not what C++ was made for, and won't help you that much.
>>
File: 1483730818833.png (160KB, 373x345px) Image search: [Google]
1483730818833.png
160KB, 373x345px
>>58782812
He writes even worse languages.
>>
>C
hammer, nail, screwdriver, screws, 2x4s
>C++
an entire hardware store
>Java/C#
a contracting company
>Python
pre-built bungalow
>Haskell
a set of alien tools
>>
>>58782922
>OOP is not what C++ was made for
I'm pretty sure that was exactly what C++ was made for.
>>
>>58782930
The mistake was making the language based on an academic committee, that shit never ends well.
>>
>>58782937
>an entire hardware store
Unorganized hardware store.
>>
>>58782939
It depends on your definition of what is "OO". It's certainly far removed from Smalltalk and the ilk.
>>
>>58782922
>OOP is not what C++ was made for
http://www.cplusplus.com/info/history/
>"Shortly thereafter, he began work on "C with Classes", which as the name implies was meant to be a superset of the C language. "
>this later became C++
>>
File: mule.jpg (77KB, 900x602px) Image search: [Google]
mule.jpg
77KB, 900x602px
whats the mule of programming languages?
>>
>>58782981
Objective C
>>
>>58782939
C++ was just meant to be C interbred with Simula.
>>
>>58782996

perfect
>>
File: missingzero.png (13KB, 1024x768px) Image search: [Google]
missingzero.png
13KB, 1024x768px
Looks like you're missing a zero there Linus
>>
>>58783006
>perfect
An abomination almost as bad as swift
>>
File: 1410056650311.png (40KB, 200x200px) Image search: [Google]
1410056650311.png
40KB, 200x200px
Why the FUCK are there like 20 different versions of Python?

I demand a fucking answer
>>
>>58783072
Kill yourself, you retarded frogposter.
>>
>>58783017
where can I learn how to do this
>>
>>58783072
gradual improvements happen over time
>>
>>58783072
freedom
>>
>>58783072
>Why the FUCK are there like 2 different versions of Python?
Fixed that for you.
>>
>>58782667
what font is that
>>
>>58783205
http://int10h.org/oldschool-pc-fonts/fontlist/#ibm_2nd_gen I presume
>>
Working on a really complex macro
#lang racket
(require "fusion.rkt")

(define N 8000000)

(printf "- fused:\n")
(void (time (fuse (reverse (filter even? (range N))))))
(printf "- un-fused:\n")
(void (time (reverse (filter even? (range N))) ))


- fused:
cpu time: 1043 real time: 1044 gc time: 857
- un-fused:
cpu time: 4894 real time: 4893 gc time: 4087
>>
>>58782939
That's what it was made for but that's not really how it is right now.
C++ has drastically improved (not that it's GOOD now), and there's no reason to use "old C++". However I don't think there are many modern C++ manuals for beginners. You shouldn't be learning C++ as a beginner at all unless you don't intend to make real sotware with it (e.g., it's OK to "learn" C++ to use arduino, but you're not going to get anything close to a big picture of the language).
>>
>>58781577
God's work
>>
File: 1243458022222.png (11KB, 645x773px) Image search: [Google]
1243458022222.png
11KB, 645x773px
pleb here
what's a good IDE to use?

Looking to program in C/C++ and java.

Didn't like Eclipse too much, so far I'm using Code Blocks and JCreator

Can /g/ recommend better options?
>>
>>58783366
IntelliJ Idea, CLion
>>
>>58783443
Oh yeah, how is CLion? Been meaning to get in to that shit.
>>
>>58783366
>C/C++
Why did you group two completely different languages together?
>>
>>58783366
>Looking to program in C/C++
Visual Studio
>java
There's extensions for that, no idea how well that's gonna work out
https://marketplace.visualstudio.com/items?itemName=SamHarwell.JavaLanguageSupport
>>
>>58783366
Jetbrains makes pretty much top tier IDEs
>>
>>58783463
c++ IDEs shouldn't have any problem with C
>>
>>58783522
this
>>
what extra information does IR have that makes it better for optimizing code?
>>
>>58783611
i mean, as opposed to just generating directly by walking the AST
>>
>>58783628
nothing, but it's far easier for a person to reason about
>>
>>58783366

Clion
>>
>>58783366
C/C++: Qt ; Clion; Geany
Java:IntelliJ Idea/Netbeans
>>
>>58783241
thanks
>>
C++ is directly a superset of C, right? As in, anything you can do in C, you can do in C++ plus additional things? Why then, are some things seemingly C-only like operating systems and embedded systems?

I guess I just don't understand what someone sacrifices by using C++ instead of C
>>
>>58783733
>C-only like operating systems
Windows is probably C++. That's why it sucks.
>>
>>58783733
>C++ is directly a superset of C, right?
Not quite. That was the original intention but standards have diverged and there have been breaking changes.
>>
>>58783733
>C++ is directly a superset of C, right? As in, anything you can do in C, you can do in C++ plus additional things?
No. That hasn't been true for a very long time.
>Why then, are some things seemingly C-only like operating systems and embedded systems?
C is simple and easy to implement. It doesn't cause massive amounts of bloat to be generated like C++. It doesn't hide shitloads of information from you like C++.
Really, it's a much better designed language with a much more focused niche that it tries to fit into, and C++ is just utterly inappropriate for that niche.
>>
>>58783733
Really, you can't understand why an overly complicated and bloated language might not be a great idea for embedded systems?

But to actually answer your question: you sacrifice low mental load. C is simple, no overloading, syntax always means the same thing.

You have no guarantee than any piece of C++ does what you think it does without checking every single included file, just in case.
>>
>>58783741

Windows uses C++ for user land code and C for kernel code. While it is possible to write a kernel in C++ and assembly with no C source files, it isn't common.
>>
>tfw even my cat is better than me at programming

How to git gud?
>>
>>58783789
>C is simple and easy to implement. It doesn't cause massive amounts of bloat to be generated like C++. It doesn't hide shitloads of information from you like C++.
>Really, it's a much better designed language with a much more focused niche that it tries to fit into, and C++ is just utterly inappropriate for that niche.

That's why Go was born.
Still, /g/tards hate it.

Figures.
>>
>>58783808
The only example of using C++ in a kernel I know of is the XNU I/O Kit, which uses a restricted subset of C++.
>>
>>58783849
>Garbage collected
Immediately disqualified.
>>
why is Java such a well defined language? I have never seen a better programming language do OOP better
>>
>>58783854

VxWorks uses C++ in the Kernel. Pretty sure it's all C++98 though.
>>
>>58783862
>collecting your own garbage
this isnt spring cleaning lmao
>>
>>58783854
Dude, every C++ project is a "restricted subset of C++".

Nobody has the mental capacity to use all of the features.
The only exceptions are the C++ compilers.
>>
>>58783863
Try C#.
>>
>>58783863
Because 8/10.
>>
>>58782013
>to smart

it is
>too smart

Ya, stfu you pseudo intellectual.
>>
>>58783863
Really, you've never seen C before?

Forced OOP is Java's worst issue.
>>
File: 1485889119752.gif (8KB, 645x773px) Image search: [Google]
1485889119752.gif
8KB, 645x773px
>he doesn't use Hack
>>
how do you not feel like total garbage when told that CS is easy as shit and that you're a code monkey, blah blah blah?
>>
>>58783896
Learn CS and become not a code monkey.
>>
>>58783890
>fry.jpg
>>
>>58783895
>he uses Hack
>>
>>58783895
>using a literal meme language
>>
>>58783862
Go is not running on JVM, bear that in mind.

Sub-millisecond GC pause in Go 1.8

>BTFO
>>
>>58783920
>Go is not running on JVM, bear that in mind.
Still uses stop-the-world GC, which is absolute garbage.
>>
>>58783920
It doesn't matter.
Being garbage collected immediately makes a language unsuitable for being a C replacement.
Can you write Go without the runtime?
>>
>>58783920
can we all agree that the JVM is pure genius
>>
>>58783733
It's easy to get carried away with C++ concepts, and true C++ code doesn't look anything like C code. I have seem projects that were basically just C plus some helpful C++ features (enums for compile to optimization, and minor template usage), but it is rare.
>>
>>58783933
Actually not, since 1.4 it uses some fine-grained GC techniques, which are performed on a non-blocking GC thread.
Why do you people talk shit without knowing shit?
Fucking /g/

>>58783934
>implying C++ doesn't have runtime support

>>58783956
Nope, since Go+Docker came by
>>
>>58783934
Here's an idea:
We should replace C in a lot applications that don't need to use C, without having to completely replace C in the contexts where it is irreplacable.
>>
>>58782937
>alien tools
that's a funny way of spelling the word memes
>>
>>58784000
but Java is superior to Go in all instances
>>
>>58784000
>>implying C++ doesn't have runtime support
I'm talking about C. Don't bring up other shit.
Yes, C has a VERY minimal runtime, but you don't even have to use it.
You can write freestanding code that will work without even an operating system present (basically, how kernels are written).
>>
I want to program. I know nothing about programming. I'm a 20 year old fuckup, so I figure I could at least take up a hobby that won't numb my brain. Can any of you solve my problems?
>>
>>58783934
Then again, why replace C?
Go isn't done to replace C, that works great.
Same cannot be said about C++, at all.

>>58784022
>low quality bait

>>58784025
Again, we are talking about C++, not C.
C is great by itself, no need to replace it.
>>
>>58784006
Why though?
Is reimplementing shitloads of existing software in yearly meme-lang #12 going to make it better, just by virtue of being written in another language?
>>
how tf do i generate assembly from an AST?
>>
>>58783896
The people that say that have never programmed a nontrivial thing in their lives.
>>
>>58784033

youre gonna have to bite the bullet and learn yourself, my friend. We will not and can not do anything for you but recommend books and other resources. Start with C Primer. Good luck, my friend.
>>
>>58784025
>You can write freestanding code that will work without even an operating system present (basically, how kernels are written).
You can do the same with C++.
In fact my operating systems class at University used C++ to write a standalone kernel.
>>
>>58784068
>You can do the same with C++.
And you lose the whole C++ standard library and a bunch of the reasons that fags even use C++ over C.
Even then, it's still a minefield of features you need to be careful of, and avoid.
You may as well just not be a fuckup and use C.
>>
I don't get why you're comparing kernel development between C/C++ and Go.

Go is born to do system development, like high performance applications, without having to use that complete uttershit of a language that is C++.
And it works great, even with a GC.

Then again, I don't know why someone right in his head would ever write kernel code in C++
>>
>>58784048
Maybe, a lot of C software is written badly (insecure, memory leak, etc.). I'm not asking that you immediately start reimplementing everything, but there are a lot of bored programmers who like to write Go and if they can produce better alternatives then we should welcome it, because C is an outdated language.
>>
at the_ultimate_program.c ; clang the_ultimate_program.c ; ./a.out
void abort(void);
int puts(const char *);
int system(const char *);

int main()
{
puts("Your code is bad and you should feel bad.");
system("rm " __FILE__);
abort();
}
Your code is bad and you should feel bad.
Abort trap: 6


Hold by beer, watch this.
>>
>>58784115
>Software is bad just because it's written in C.
And you're a retard.
There is no point continuing this discussion.
>>
You guys have any good sources for learning Swift?
>>
>>58784000
>Actually not, since 1.4 it uses some fine-grained GC techniques, which are performed on a non-blocking GC thread.
[citation needed]
>>
>>58781733
5 (swift) has type classes and reference counting GC so it's at least a step below haskell. It only needs a concurrency/parallelism model.

Referencing counting allows it to be used for games as well
>>
>>58784168
learnyouahaskell.com
>>
>>58784050
in phases
first parse the AST for information about bindings (local variables vs functions)
then traverse the AST and allocate register locations for each sub expression (not necessarily hardware registers, you want to make an abstract register allocation routine)
then compile each sub expression into appropriate instructions
finish the function assembly by putting initialization code at the preamble and then cleanup code at the end.
output all of the compiled functions to a file and wow you've written your first basic compiler

>>58784148
>reading comprehension
I never implied that software is bad because it's written in C, rather that there is a lot of bad software written in C that would probably be easier to write correctly in another language.
>>
why is Java such a difficult language to learn?
>>
>>58784172
https://blog.golang.org/go15gc

It's Go 1.5, sorry for the mistake
>>
>>58784177
But I'm already using that to learn Haskell. I want to learn Swift.
>>
>>58784187
will i need to link to libc for printing stuff?
>>
>>58784202
It isn't. You're just a dummy (^:
>>
>>58784261
write a kernel in Java
>>
I'm pretty new to programming and C++ and need some help. I'm trying to use ifstream to open a file. if it exists then it writes the data from that file into an array, if it doesn't exist then it doesn't write the data and my program continues as normal. problem is my program crashes if the file doesn't exist. any ideas?
>>
so ugh, how do you remove a global stack page (why isn't this in the tool functionality anyway)
>>
>>58784303
>write a kernel in Java

This further proves that you're just a dummy boi
>>
>>58784311
try using file.good() to check if it exists
>>
>>58783017
If you are talking about SYSSEG, Linus didn't miss any zero. Remember, the OS is in real mode at that point, so memory is segmented in the [segment]:[offset] address fashion, which maps to physical address [segment]*0x10+[offset].
The kernel is loaded at address 0x1000:0, which maps to 0x10000, which is exactly what Linus says.
>>
>>58783893
Scala is pretty nice
>>
Programming Principles and Practice using C++ by Stroustrup

good book or no?
>>
Can somebody explain to me the logic behind GNU style code indenting?

Why would I indent for the braces, and then indent AGAIN for the code? Why double indent for every code blocks? WHY?

I don't give two shits what line you put your braces on, but I cannot wrap my head around giving them their own indentation.
>>
>>58784700
Stallman was a lisp-fag, so I think that had something to do with it.
>>
has anyone ever witnessed someone failing at fizz buzz with their own eyes?
>>
do you know the magic value of EOF?
>>
>>58784869
No, but there's an article you might enjoy if you're not currently referring to it.
>>
>>58784954
It's likely -1, but the exact value is not important.
>>
>>58784700
The only logic would be that it would force you to keep your functions very short, because after 3 levels of nesting you are already 6 indents deep.

I'd rather have a few slightly longer than ideal functions, than a load of single-use, broken-down split functions that add to the callstack.

Even kernel style is mildly retarded, sticking to 80 columns with tabs set to 8 is a fucking nightmare, unless you functions are all named like zrn_2_hrfdrf().
>>
Why does c++ work like this?
// This compiles
vector<vector<ClassName> > A;

// This doesn't
vector<vector<*ClassName> > B;
>>
>>58785023
>I realized what was wrong as soon I posted it
I'm retarded. I spent like 20 minutes stuck on this too.
>>
>>58785023
Because the pointer is on the wrong side of the type.
Also, why the fuck are you using C++?
>>
>>58785023
If you are already nesting vectors, why would you use pointers at all?
>>
if Java has a garbage collector, why can't it throw itself out?
>>
>>58782027
>Are graphics libraries like SDL an OpenGL written from near scratch for every platform they run on?

No

>And if your game supports DirectX and OpenGL, how does that work? Is it just a literal ton of if(using openGL) do this else do this?

It's more complex than just basic conditional statements. A graphics card may have bare bones logic gates/circuitry within the GPU that let you perform complex functions. Functions that would require multiple steps if done on a CPU.

For example you could point to the location of some data(like a texture) in memory and tell the GPU to tessellate it, or decompress it, or blend/move it around in relation to some other set of data.

Instead of giving the CPU 30 separate basic instructions/statements to perform the task, you just give the GPU one specific instruction.

Most of functions GPU's perform can be done on a CPU but it requires extra code to explain things and takes a shit load more time and processing power.

DirectX and OpenGL are just sets of instructions(advanced ones) that can be handled directly on graphics hardware. Not all hardware supports both of them, and new instructions are added with every new DirectX/OpenGL version.

Some of the instructions are very similar, so sometimes it's easy to port your game from one to the other.

Sometimes you don't have all the needed instructions available so you have to emulate that function in software; or break it down into simpler instructions, before passing it to the hardware.

Sometimes the target CPU supports a couple simple GL/X operations or multimedia extensions that are close enough for the job at hand.

Parallel processing on the GPU helps a shitload. It's hard to explain what happens on the hardware itself. A gross oversimplification of it would be saying they can perform 20 or more if/else statements at once. But the can't perform 10 if's and 10 else's at the same time.
>>
>>58785056
Excuse me?
>>
>>58785073
it's still collecting pajeets poo in the code
>>
>>58785073
Every time it tries, Haskell produces another GiB of Java per second.
>>
>>58785073
Because the bloat expands so fast it can't keep up with itself.
>>
>>58785054
Yes the physical act of writing or typing something tends to help comprehension and retention

im pretty bad at taking notes but it's a good idea to make yourself do it anyway
>>
>>58785065
Because he's a retard that wants lots of indirection.
>>
>>58785114
There is no problem that cannot be solved with sufficient indirection.
>>
>>58781558
That's neat, what language do you use to program in for work?
>>
>>58785164
He's a doctor.
>>
>>58781648
Actions speak louder than words.
>>
>>58785065
Should I not be using pointers? The Object in the vector will be in multiple vectors. I don't want to have unnecessary copies of it.
>>
>>58783261
And what exactly does fuse do? I'm curious to see the code.
>>
File: 173564.png (229KB, 495x495px) Image search: [Google]
173564.png
229KB, 495x495px
When was the last time you programmed something actually useful instead of "solving problems that shouldn't have existed in the first place"?
>>
>>58781648
Probably not, but I don't really brag all that much, as I'm quite aware of my limits.
>>
File: C3wF7d1UYAA_Lt7.jpg (121KB, 605x800px) Image search: [Google]
C3wF7d1UYAA_Lt7.jpg
121KB, 605x800px
>>58785270
Never
>>
>>58785270
Define useful, I've just recently finished a tool for myself that handles all I need with regards to sadpanda.
>>
Just a simple text adventure game in python. Nothing much
>>
>>58785270
I wrote an image viewer than tags and embeds XMP metadata inside images. It's all searchable from a database, too, so it's incredibly useful to me. It's like having a personal booru.
>>
>>58785270
When I was at work today...
>>
File: 1482209151825.jpg (174KB, 1083x720px) Image search: [Google]
1482209151825.jpg
174KB, 1083x720px
What happened to the anon making akari-bbs?

https://github.com/microsounds
>no updates since jan 9

http://akaribbs.mooo.com/
>loads of spam
>>
>>58785126

Performance.
>>
>>58785402
You just need more pointers for that.
>>
>>58781558
>>58785401
>>
>>58785401
>things that aren't true unless you go out of your way to make them so
>>
>>58785357
Anyone?
I am worried
>>
>>58785357
>>58785540

Rest in peace
>>
File: 1481664473008.png (175KB, 482x436px) Image search: [Google]
1481664473008.png
175KB, 482x436px
>>58785566
don't joke about that
>>
What's the easiest way to export a ~50GB MySQL table to a JSON/SQL format so I can use it in a NoSQL solution?
>>
>>58785576

I'm serious. He will be greatly missed.
>>
>>58785582
Iteratively.
>>
>>58785582
awk
>>
Any good and well documented free to use C++ audio libraries? Something with the simplicity of SDL2's Mixer?
>>
>>58785641
SDL2_mixer
>>
>>58785582
migrate to PostgreSQL
use the built-in JSON functions
https://www.postgresql.org/docs/current/static/functions-json.html
>>
File: 1485646993138.jpg (41KB, 466x800px) Image search: [Google]
1485646993138.jpg
41KB, 466x800px
>>58785609
stop
i'll kill you
>>
>>58785665

I wish you would.
>>
>>58782618
That all depends. Do you want to load a "byte" of data into register 0 and register 1. Or do you want to load whatever "1" is into resister 0 and register 1.... at least I think that's what the second line does...

You know what, screw it, just use the first one.
>>
>>58785696
l agree.
>>
>>58785696
Seconding; someone please kill OSGTP.
>>
>>58785702
it loads a byte of data from the address in r0 into r1
>>
Why do rainbow colored knee socks improve your programming ability?
>>
>>58785746
induces female hormone secretion which makes you smarter
>>
File: 1477827918516.png (131KB, 1920x1055px) Image search: [Google]
1477827918516.png
131KB, 1920x1055px
Help plese. I want to write a program that
1. reads user input
2. eliminates multiple spaces
3. output the refined text

So I set a loop if the user input space for the second time. But it's breaking the program.
#include <stdio.h>

#define EXIT_SUCCESS 0
#define UNUSED -1

int main(void){

int c=UNUSED;
while((c=getchar())!=EOF){
//if there is a space, trigger the loop
if(c==' '){
//this loop detects if the next input is a space
int d=UNUSED;
while(((d=getchar())==' ') && d!=EOF){
//if it's a space do nothing and read again
;
}
//keep one space as intended
putchar(' ');
//print the char after the space-eliminate loop is finished
putchar(d);


}
putchar(c);

}
return EXIT_SUCCESS;
}

>>
>>58785714
>>58785724

Bless you, both.
>>
>>58782707
>We're building up an analytics service that uses raw geolocation data to do users profilation and such

>it has some unique perks like motion recognition

Does it run all the time or only when the app is in the foreground? Can you tell when users are jacking off based on gyro/accelerator data?
>>
>>58782474
>no thighhighs
you aren't fooling anybody anon
>>
>>58785287
Either use nhentai or stop fapping.

>>58785334
Any booru running locally would do it.
>>
>>58785781
post an example of input and output program
>>
>>58785829
It's in the screenshot (right window)
>>
>>58783733
A lot of the features C++ offers are either not required or not good to have for embedded systems. Templates produce way too much object code on systems with restricted memory, exceptions incur a lot of overhead when they are thrown, list goes on. It's also not as portable as C, which is not super important on embedded since there's usually 1 target system for a program, but for things like operating systems, drivers, compilers for other programming languages, it matters quite a lot.
>>
File: wtfman.jpg (111KB, 550x413px) Image search: [Google]
wtfman.jpg
111KB, 550x413px
>>58785781
>#define EXIT_SUCCESS 0
>>
>>58785825
>pinning the fjords
>>
>>58785799
too gay
>>
>>58785781
maybe this?
#include <stdio.h>

#define EXIT_SUCCESS 0
#define UNUSED -1

int main()
{
char input[100];
int i = 0, j, n = 0;
while ((input[n] = getchar()) != '\n') {
n++;
}
input[n] = '\0';
while (i < n) {
if (input[i] == ' ' && (input[i + 1] == ' ' || input[i - 1] == ' ')) {
for (j = i; j < n; j++) {
input[j] = input[j + 1];
}
n--;
} else {
i++;
}
}
puts(input);

return EXIT_SUCCESS;
}
>>
>>58785781
wah
#include <stdio.h>

int main (int argc, char *argv[]) {
char c = 0;
int i = 0;
while (( c = fgetc(stdin)) > 0) {
if (c == ' ' || c == '\t') {
if (i) continue;
i++;
putchar (' ');
} else {
i = 0;
putchar (c);
}
}
return 0;
}
>>
>>58785781
EXIT_SUCCESS is already defined in stdlib.h. The reason for this is portability (Imagine a system where 1 is defined as success, and 0 and below are failures).

It doesn't matter for small pet programs and stuff you are writing to learn, but you probably shouldn't redefine it.
>>
File: 1469701781068.png (141KB, 1920x1055px) Image search: [Google]
1469701781068.png
141KB, 1920x1055px
>>58785781
NVM fixed it
>>58785912
Thanks for your effort, anon.
>>
>>58785936
#include <stdio.h>
#include <stdlib.h>

#define UNUSED -1

int main(void)
{
int c = UNUSED;
while ((c = getchar()) != EOF) {
//if there is a space, trigger the loop
if (c == ' ') {
putchar(c);
//this loop detects if the next input is a space
int d = UNUSED;
//if it's a space do nothing and read again
while (((d = getchar()) == ' ') && d != EOF);
//print the char after the space-eliminate loop is finished
putchar(d);
} else {
putchar(c);
}

}
return EXIT_SUCCESS;
}
>>
>>58785781
use sed nigga
$ cat space 
hello world
inst all gent ooo
t b h
$ sed 's/\(\s\s*\)/ /g' space
hello world
inst all gent ooo
t b h
>>
>>58782704
because you're a vsfag
>>
>>58785924
>
#include <stdio.h>

int main (int argc, char *argv[]) {
char c = 0;
int i = 0;
while (( c = fgetc(stdin)) > 0) {
if (c == ' ' || c == '\t') {
if (i) continue;
i++;
putchar (' ');
} else {
i = 0;
putchar (c);
}
}
return 0;
}

vs
#include <stdio.h>
#define UNUSED -1
int main(void){
int c=UNUSED;
while((c=getchar())!=EOF){
if(c==' '){
putchar(c);
int d=UNUSED;
while(((d=getchar())==' ') && d!=EOF){
;
}
putchar(d);
}else{
putchar(c);
}

}
return 0;
}


fight
>>
>>58786020
>int argc, char *argv[]
>>
>>58785936
Y U assign to fields only to immediately assign another value? UNUSED might as well be unused.
>>
>>58786041
that would leave d unitialized in some cases
>>
File: 1480187072128.png (521B, 163x209px) Image search: [Google]
1480187072128.png
521B, 163x209px
Is it possible to have bots on 4chan?

i mean, they would have to pass the captcha....

or how does it work?
>>
>>58786073
buy it a pass :3
>>
>>58786073
http://www.deathbycaptcha.com/

sweatshop slaves solve CAPTCHAs for you in seconds
It's like $5 for 1000 CAPTCHAs
>>
>>58785781
Can anyone implement recursion int this example?
>>
>>58786081
interesting.

so why do people say that some posts on 4chan are made by bots?

even if you had people solving the captcha for you, they wouldn't post shilling comments
>>
>>58786103
f [] = []
f (' ' : ' ' : xs) = f (' ' : xs)
f (x : xs) = x : f xs
>>
>>58786112
What do you mean?
The bot can use DeathByCAPTCHA's API
>>
>>58786124
That looks so fancy yet unintuitive
>>
>>58786126
ohhh....

right.

yeah that makes sense.

thanks
>>
>>58785246
It parses the calls to various functions and transforms it into a loop that has (hopefully) equivalent sementics.
Patterns are divided into producers, e.g.
(range N)
(build-list N Func)
(vector->list V)
<raw expression that evaluates to a list>

Transformers, e.g.
(map F List)
(filter Pred List)
(append* ListOfLists)

And consumers, e.g.
(foldl Func Init List)
(foldr Func Init List)
(reverse List)
(length List)
(list->vector)
<nothing, which returns the list and is the same as (foldr cons '() List)>

Which gets turned into a loop and a series of lambdas for folding, which removes potential all intermediate conses.
>>
>>58786073
arguments to its dictionary "template" function doesn't work. i always get a visit from near scratch for you don't need to run in c++ (or c). but the driver. though there's all kinds of if(using opengl) do you write something like all the os side.
>>
what do you guys think about JavaFx?
>>
>>58784218
That would make everything easier if you call C functions instead of syscalls. Also consider making your own small runtime lib in C and linking with that.
>>
>>58786156
use Java-GTK
>>
>>58786156
its great

better than Swing
>>
>>58785825
Does booru software embed metadata? Or support FLIFs?
>>
>>58786170
warcraft, you peed your fizzbuzz going son? not _that_ bad 5 languages for real programmers that's pretty nifty, what do ya think that someone could help you more.
>>
>>58786166
why Java GTK over JavaFX?
>>
>>58786183
random blog posts from the header, has shitty comments, is necessary. you to know if you want to try to perform modifications to go. eah but for you, then yes,
>>
is node js just a huge gimmick or is it only going to grow?
>>
>>58786136
>unintuitive

f (empty list) = (empty list)
f (string beginning with two spaces) = f (the same string but beginning with only one space)
f (string) = first part of that string followed by (f (rest of string))
>>
>>58786193
Both.
>>
>>58786193
you live and in it in good languages though. top 5 meme programmers: 4 out of writing a literal ton of drivers and oss. very often graphics is really your pants
>>
>>58786209
you're a markov chain
>>
>>58786209
>>58786175
>>58786192
shitposting bot?
>>
>>58786149
>>58786175
>>58786192
>>58786209



words = text.split()
lwords = []
ddict = {}
next_word = False
new_article_words = []
string = ""

for i in words:
i = i.lower()
lwords.append(i)

for k,v in zip(lwords, lwords[1:]):
ddict.setdefault(k, [])
ddict[k].append(v)


start_word = random.choice(lwords)

running = True
while running == True:

new_article_words.append(start_word)

if start_word in ddict:
possible_words = ddict.get(start_word)
next_word = random.choice(possible_words)
if len(new_article_words) > 2 and new_article_words[-1] == next_word or len(new_article_words) > 30:
break
else:
start_word = next_word

for i in new_article_words:
string+= i
string+= " "
print(string)

>>
>>58786227
winwar
>>
what happened to the /dpt/ OP posts that had all the google docs / pastebins with information and shit

haven't lurked here in like a year
>>
>>58786261
That was just a phase anon.
>>
>>58786261
I wish GNU sold sex toys
>>
File: game.png (182KB, 1920x1080px) Image search: [Google]
game.png
182KB, 1920x1080px
I've been working on a game for a while, so far it looks really shitty, since i've mainly been working on mechanics.
>>
>>58786261
autists couldn't handle it
>>
>find indians vandalizing wikipedia on programming
Fucking disgusting poo s.
Fuck you Nirmal. And what the hell does "pudichi jaila podunga" mean?
>>
What's the most American programming language?
>>
>>58786466
where?
>>
>>58786527
C#?

Developed by an American company specifically to advance the company, so it's kind of a double whammy by being American and also capitalistic
>>
>>58786557
https://en.wikibooks.org/wiki/Algorithm_Implementation/Search/Binary_search
Naturally i reverted it.
>>
File: C3xwcK0VYAE2kFA.jpg (41KB, 750x623px) Image search: [Google]
C3xwcK0VYAE2kFA.jpg
41KB, 750x623px
>>58781592
>>58781577
>>58781558
>>58781539
>>
>>58786020
>>58785924
if you're using fgetc stdin why not also use fputc stdout?
>>
Bought a book.
>>
the project management features in emacs really are shitty, god fucking damn
>>
>>58786527
Haskell, because it has free monads.
>>
>>58786582
why can't machines understand this?
/*
BEGIN BinarySearch(data, size, data2Search)
SET low to 0, high to size-1
WHILE low is smaller than or equal to high
SET midpoint to (low + high) / 2
IF data2Search is equal to data[midpoint] THEN
return midpoint
ELSEIF data2Search is smaller than data[midpoint] THEN
SET high to midpoint - 1
ELSE
SET low to midpoint + 1
ENDIF
ENDWHILE
RETURN -1 // Target not found
END */
>>
>>58786685
because it's a comment
>>
>>58786685
too ambiguous
>>
>>58786692
BEGIN BinarySearch(data, size, data2Search)
SET low to 0, high to size-1
WHILE low is smaller than or equal to high
SET midpoint to (low + high) / 2
IF data2Search is equal to data[midpoint] THEN
return midpoint
ELSEIF data2Search is smaller than data[midpoint] THEN
SET high to midpoint - 1
ELSE
SET low to midpoint + 1
ENDIF
ENDWHILE
RETURN -1 // Target not found
>>
>>58786709
Is that even a programming language? That looks like pseudo code
>>
>>58786709
you could write a language where that's valid
>>
why the fuck doesnt
putchar(' ')
work . I wasted too much time figuring out it doesnt work

main()
{
char blank = ' ';
int c;

while((c = getchar()) != '\n') {

if (c!=' ') {
putchar(c);
}
else {
while((c=getchar())==' ')
;
putchar(blank);
putchar(c);
}

}

}
>>
who are the top 3 best programmers of all time?
>>
>>58786831

Mark Zuckerberg
>>
>>58786797
Works for me? What about it isn't working for you?
>>
is it pointless to specify using TCP protocol for C socket programming when already using SOCK_STREAM?
>>
>>58786797
Whats not working exactly? Why is the semi colon for your while loop on the next line?
>>
new thread fucking where
>>
>>58786881
>>58786881


WHAT THE FUCK

now its working all of sudden
>>
>>58786868
If I understand you correctly, yes, SOCK_STREAM specifies TCP, so saying something is TCP on top of SOCK_STREAM is redundant.
>>
>>58786881

and the semi-colon is in the next line because Ritchie told me to do it like that
>>
>>58786896
Does that program get rid of multiple spaces or something?
>>
>>58786905

yes
>>
Everybody here needs to watch TAD's livestream.

https://www.youtube.com/watch?v=O1bsHR2DFvk
>>
>>58786831
0. me
1. my protégé
2. anyone but u
>>
If you only have one source file is there a binary difference between your object file and your executable file?
>>
>>58786797
#include <stdio.h>

int main() {
char c;
while ((c = getchar()) != '\n') {
if(c == ' ') {
putchar(c);
while ((c = getchar()) == ' ');
}
putchar(c);
}
}


works for me
>>
>>58786979
>A guy with as many troubles as Terry can make a pretty impressive OS
>I keep throwing my projects away because they're bad
Some people find this inspirational but I just find it depressing.
>>
>>58787111
>took the time to clean his code
>still didn't add return 0;
Implicit return is cancer and ruined the C language.
>>
New thread: >>58787146
>>
>>58784960

it's a MEME ARTICLE
>>
>>58782846
>But it's the most flexible

Someone has never learned Common Lisp
>>
>>58787133
#include <stdio.h>

int main() {
char c = -1, l = -1;
while ((c = getchar()) != '\n') {
putchar((c == l && l == ' ') ? false : c);
l = c;
}

return 0;
}


fixed it for you
>>
>>58786634
Anime website
>>
>>58786709
I feel like using operator overloading in Ruby, for example, this could actually be valid code.
Thread posts: 359
Thread images: 31


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