[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: 321
Thread images: 33

File: 1498866208019.png (717KB, 1000x793px) Image search: [Google]
1498866208019.png
717KB, 1000x793px
What are you working on, /g/?


Previous Thread: >>62050247
>>
I don't think it's possible to enjoy programming.
>>
File: logotitle_2.png (13KB, 413x108px) Image search: [Google]
logotitle_2.png
13KB, 413x108px
What does /dpt/ use to listen to online radios on their mobile device? ServeStream can't into metadata
>>
File: nico_nico_nee.gif (735KB, 500x280px) Image search: [Google]
nico_nico_nee.gif
735KB, 500x280px
First for C. I am currently creating a uniform cost search algorithm so I can find an optimal solution for something. C is pretty hard but I am getting better at it.
>>
There is literally nothing wrong with pedophiles or Rust.
>>
>>62058198
or gender equality
>>
File: Chance_go_to_jail.jpg (70KB, 452x260px) Image search: [Google]
Chance_go_to_jail.jpg
70KB, 452x260px
>>62058198

There is nothing wrong with Rust, but pedophiles need to go to prison.
>>
>>62058143
>What are you working on, /g/?
learning to create users (with different access/authentication) on the phoenix framework because trying out being a wageslave
would rather i was indie developing games
>>
anzuchang is 17 years old and not a loli
>>
>>62058143
is it a mistake to mass produce a bunch of poorly polished, poorly programmed but functioning clones of simple games just to practice and to have a large volume of completed projects to show to future potential employers? because i honestly don't know what to program other than some kind of dream game project that i will discard within a week, and i really have only one or two finished projects to show for my mediocre programming skills
>>
>>62058165
it can definitely be rewarding which in itself you can derive enjoyment.
>>
>>62058225
>defending Rust

Pedophiles are the lesser evil, you dumb woman.
>>
File: app ranking.jpg (92KB, 637x640px) Image search: [Google]
app ranking.jpg
92KB, 637x640px
Quit your job and make videogames
There are people literally lined up wanting to give you cash
>>
>>62058473
Just make the 30th chess/sudoku app and put some ads on the borders, someone will download it
>>
Fuck programming as a career, it's shit

When it was just a hobby it was fun
>>
>>62058473
you don't even need to make the games, just say you will and occasionally post to a blog and the money will roll int
>>
>>62058512
That's the reason why I freelance. I couldn't stand doing this is an office setting.
>>
>>62058473
>>62058237
planning on wageslaving for about another year
hopefully i find free time to meanwhile work on my own projects
>>
>>62058225
Pedos did nothing wrong.
>>
I finally completed my "own" sum of primes below 2 million program.
I more or less had to copy someone else's code, but I made sure to spend a long time studying it, and understanding why it works the way it does and the logic behind it.
>>
>>62058532
Lol. That's easy. Let me know what you did 1 million primes
>>
>>62058555
billion wtf autocorrect?
>>
File: anime now.jpg (169KB, 971x693px) Image search: [Google]
anime now.jpg
169KB, 971x693px
Is java easy to get acclimated to if you're a C zealot?
How do i get unsigned numbers in javascript?
>>
File: wew.png (6KB, 636x34px) Image search: [Google]
wew.png
6KB, 636x34px
pretty spooped desu senpai
>>
>>62058522
Is freelancing really any better? I expect you still have to deal with ill-specified and ill-informed requirements and poor quality input data.
>>
>>62058606
plus, companies know they can just NOT pay you since the cost of your work is much less than the cost of a lawsuit.
>>
Do you guys need a degree for a programming job?
I know C pretty well I'm wondering what I can do with my knowledge
Should I show an employer some projects of mine? Would that even be enough?
>>
>>62058625
personal projects and experience will beat a degree every time.
>>
>>62058624
>the cost of your work is much less than the cost of a lawsuit.
4 U
>>
>>62058637
You'd be incredibly stupid to do thousands of dollars worth of work for a client without money down.
>>
>>62058631
Depends on the degree and the personal experience to be honest

Someone with a shitton of frontend webdev experience but nothing else applying for a backend position makes me more nervous than someone with no/little real world experience but a top tier degree
>>
>>62058643
That's fine. Companies will just give the contract to someone who hasn't learned that aspect of freelancing yet.
>>
File: 1500701014111.png (112KB, 594x483px) Image search: [Google]
1500701014111.png
112KB, 594x483px
C++ still is not "clicking with me" as much as Rust did :^(

Probably because of no UFCS and the insane amount of verbosity when it comes to using iterators in data structures.

The only reason why I am determined to use C++ is because of the Qt Quick/QML technologies. Haven't done any GUI before so I thought Qt is an easy start (as opposed to using GTK with bindings)
>>
>>62058646
why would they even apply for a backend job?
>>
Shall we make a list of acceptable /dpt/ programming languages? I'll start:

>CL
>Scheme
>>
File: stack overflow developer survey.png (71KB, 717x1177px) Image search: [Google]
stack overflow developer survey.png
71KB, 717x1177px
>>62058726
If your language isn't on this chart, it's irrelevant toy garbage.
>>
>>62058721
They're (understandably) fed up of JS?
>>
In C++ why aren't all types objects, doesn't that mean that it's not really an OOP language??
>>
>>62058746
In Java not all types are objects, does that mean it's not really an OOP language?
>>
>>62058726
>Lisp garbage
>>
>>62058741
>cuck overflow
>>>/trash/
>>
Thoughts?

 :- module fib.
:- interface.
:- import_module io.
:- pred main(io::di, io::uo) is det.

:- implementation.
:- import_module int.

:- func fib(int) = int.
fib(N) = (if N =< 2 then 1 else fib(N - 1) + fib(N - 2)).

main(!IO) :-
io.write_string("fib(10) = ", !IO),
io.write_int(fib(10), !IO),
io.nl(!IO).
>>
>>62058780
>:- everywhere
>write_string
>!IO

Absolute trash.
>>
>>62058555
I know it's not that impressive, but I'm proud of myself for kind of solving this problem that has been plaguing me.
>>
>>62058741
>R 4.4%
this is the real reason I hate python
fuck off python
>>
>>62058792
>idiot doesn't know how mercury is written
As expected from a brainlet.
>>
>>62058810
by solving you mean convincing yourself you did something by copying someone else's code? and then getting some dopamine from posting about it on an estonian metalworking forum?
Yes, good job! Well done my friend
>>
>>62058606
>>62058624
It's better because I can take naps at 2pm and I have a steady stream of clients since I'm working in a niche field that desperately needs my type of programmers.

I have an attorney that makes the contracts with clients which I look over. A lawsuit or not, I will get paid one way or another.
>>
>>62058865
I even forgot
>periods after things
>func

The language is trash.
>>
use strict;
use warnings;
use IO::Handle;

my ( $remaining, $total );

$remaining = $total = shift(@ARGV);

STDOUT->autoflush(1);

while ( $remaining ) {
printf ( "Remaining %s/%s \r", $remaining--, $total );
sleep 1;
}

print "\n";
>>
>>62058886
What does this program do?
>>
>>62058895
Counts down the seconds up to a given threshold.
>>
Has anyone here used libui? I want to use cairo inside its drawing area for drawing, but the arguments state a need for a "AreaHandler"?
>>
Reminder that Haskell is obsolete

https://www.youtube.com/watch?v=ad4BVmPni7A
>>
>>62058473
>Quit your job and make videogames
>There are people literally lined up wanting to give you cash
This is what a stupid 3D artist would say.
>>
File: hifumi_fine.jpg (90KB, 250x405px) Image search: [Google]
hifumi_fine.jpg
90KB, 250x405px
>>62059011
Good 3D artists are sorely needed. If you can do that and programming you can make bank.
>>
>>62058987
unfortunate that such an insufferable character is talking about something interesting to me
>>
>>62059112
Why is he an insufferable character?
>>
File: nervous_as_fuck.jpg (121KB, 911x720px) Image search: [Google]
nervous_as_fuck.jpg
121KB, 911x720px
>tfw your programming friend turns into a trap
t-traps make good programmers right?
>>
File: 1503519892675.jpg (132KB, 795x1036px) Image search: [Google]
1503519892675.jpg
132KB, 795x1036px
>>62059205
Yes.
>>
>>62059169
perhaps upbringing
>>
File: shock.png (374KB, 808x512px) Image search: [Google]
shock.png
374KB, 808x512px
>>62059264
I don't understand though, his build was naturally effeminate but he didn't act like a girl and now he changed his name and grew long hair which he dyed purple and he's a girl. I don't think he even programs anymore. Why would he become a trap if he doesn't program anymore?
>>
https://pastebin.com/RhXaTt2a

After calling
graph_new
and subsequently
graph_free
valgrind is complaining that 3 allocated, but only one free https://pastebin.com/7FBYPrdj

Assuming that those unfreed are
g->edges
&
g->vertices
can someone tell me why they aren't being freed?
>>
File: 1 - JDvppcW.jpg (403KB, 848x1234px) Image search: [Google]
1 - JDvppcW.jpg
403KB, 848x1234px
>>62059301
It sounds like he went too far. You are only supposed to be a girl(male). If he went on HRT then all of his masculine advantages are fleeting and thus will lose interest/ability to program.
>>
>>62059309
Because you aren't freeing them you dunce. Doing free(tree) when tree is a pointer to a struct with pointers doesn't free the pointers inside it.
>>
/agdg/ on /vg/ says the trap posting here is just 1-2 mentally ill rust posters. Is this true?
>>
>>62059407
Yes it is.
t. that guy who also frequents here
>>
>>62059407
I just happen to like rust and the trap posting is inconsequential. I doubt rotate or sourcefam are here. Or the couple other rust posters in /agdg/
>>
>>62059407
Pretty much. That is your mind on Rust (tm).
>>
>>62059060
>make bank.
*less than most other jobs
Going into videogames for money is one of the stupidest things that you could do.
If you want to make money you'd do middleware.
>>
>>62059407
I think there's some that tag along occasionally as it's now a meme. But it's very stale now. I see it disappearing soon.
>>
File: 1486061929387.png (147KB, 500x735px) Image search: [Google]
1486061929387.png
147KB, 500x735px
>>62059510
This is not wrong.
>>
>>62059531
Kill yourself, Aoba.
>>
>>62059544
R U D E
>>
where are the pics of agdg-tan and dpt-tan hanging out and being best friends
>>
Completed a light box solver for Oldschool Runescape today.
https://github.com/subjectivelyobjective/osrs-lightbox-solver

What's the "correct" way to write setup scripts for Python? My setup.py is a complete and utter hackjob.
>>
File: anime urine dispenser.jpg (84KB, 567x800px) Image search: [Google]
anime urine dispenser.jpg
84KB, 567x800px
I'm working on a blackjack game.
I finished the poker deck simulator, what's a portable way to do simple graphics to display a card game?
>>
File: 1503551563128.png (457KB, 707x678px) Image search: [Google]
1503551563128.png
457KB, 707x678px
>>62059501
>>
>>62059806
Try SDL. Or something simpler. It depends, what language are you using?
>>
>>62059826
C
>>
Have you written a chess AI yet?
>>
>>62059806
do a webapp faggot
>>
>>62059832
I'm shit at chess tho
>>
Can I use dlload and dlsym on windows even though the shitty platform isn't even POSIX compliant?
>>
>>62059890
You cannot call yourself a real programmer until you develop a decent Chess AI.
>>
>>62059893
LoadLibrary/GetProcAddress respectively
>>
>>62059940
I'm not going to use some retarded fucking <windows.h> shit. Is there POSIX dl for windows?
>>
>>62058753
Yes
>>
>>62059963
>i want to develop for windows but i dont want to use the windows api
"no"
>>
>>62059963
As you said yourself, Windows is not fully POSIX compliant. You're going to need to use Windows syscalls.
>>
>>62059991
dumb retard, have you never head of portable libraries?
>>62059963
Use cygwin
>>
>>62060020
retard
>>
>>62058741
>no scheme
>PHP that high at 28%
The programming community really is a joke these days.
>>
Halfway through writing an installer for our new product, I realized that I was well down the road of reimplementing ncurses in node.
>>
>>62058741
But this isn't the TIOBE index, anon.
>>
(require 'macro) ; Required to use this with SCM. Other Scheme implementations
; may not require this, or it may even be an error.
(define *cont-stack* '())

(define (push-catch cont)
(set! *cont-stack* (cons cont *cont-stack*)))

(define (pop-catch)
(let ((retval (car *cont-stack*)))
(set! *cont-stack* (cdr *cont-stack*))
retval))

(define (throw exn)
(if (null? *cont-stack*)
(error "Can't use throw outside of a try form")
((car *cont-stack*) exn)))

(define-syntax try
(syntax-rules (catch)
((try (body ...)
catch exception (catch-body ...))
(call-with-current-continuation
(lambda (escape)
(dynamic-wind
(lambda ()
(let ((exception
(call-with-current-continuation
(lambda (cc)
(push-catch cc)
#f))))
(if exception
(begin catch-body ... (escape)))))
(lambda ()
(begin body ...))
(lambda () (pop-catch))))))))
>>
How does /g/ feel about FORTRAN?
>>
>>62060256
>exceptions
Lisp is disgusting.
>>
>>62060306
>thinks that's lisp
Hello retard.
>>
Learning Lua so I can make WoW addons.
I'm not sure if these addons look like such a mess because of Lua or because nobody knew how to write them properly back in 2006
>>
>>62060315
>Lisp: Bleeding edge edition
scheme and lisp are both trash.
>>
>>62060327
t. brainlet
>>
>>62060306
Scheme's not lisp though.
>>
>>62058576
>unsigned numbers in javascript

javascript only understands floating point
>>
>>62060382
Lmao
>>
>>62058143
Everyone hates pedophiles obviously but why is she in particular so singlemindedly passionate about it?
Did something perhaps happen to color her opinion?
:^) 8===>
>>
>>62058576
You should look into C++ as a way of mentally transitioning. If you're truly a C zealot the mandatory OOP can come as a shock and a deterrent and it's easier to get used to if you already understand how OOP works in the low level functional terms you're used to
>>
>>62060340
>a dynamic lang
>calling others brainlets
wew laddie
>>
>>62060475
You are a literal brainlet though. Scheme and Lisp are some of the most influential languages ever, and here you, a complete imbecile, shitting on them because your tiny brain can't quite read it.
>>
>>62060483
>completely irrelevant
>literaly 0 software written in those languages
>"most influential ever"
God, functionalfags are delusional!
>>
>>62060483
>most """influential""" languages
>meanwhile the only semi-relevant (and i use that term very loosely) lisp is fucking clojure
>who wouldnt be anything without the JVM
>and whos also switching to a type system

>Lisp is barely relevant because of Java
wew
>>
File: 1485480292784.jpg (17KB, 250x250px) Image search: [Google]
1485480292784.jpg
17KB, 250x250px
#![feature(conservative_impl_trait)]

use std::fmt;

trait ying: fmt::Display {}

struct Implications;

impl ying for Implications {}

impl fmt::Display for Implications {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "I seriously hope you guys don't do this")
}
}


fn shiggy() -> impl ying { Implications }

fn main() {
println!("{}", shiggy());
}
>>
>>62060263
Outdated trash, 0/10, wouldn't write again.
>>
>>62060554
Teach me Rust, senpai
>>
>make some software
>want to share it with someone
>only places I know of are worthless garbage
The fuck? Do I just release stuff into the ether like some moron and hope someone finds my github?
>>
>>62061290
>Github
There are better choices as Gitlain, Gitgud...
>Do I just release stuff into the ether like some moron
You can announce it here.
>>
My code is so 1337 even Qtcreator gets confused
#include <iostream>
#include <string>

int
f1();

void
f0(const std::string& arg = "world")
{
std::cout << "Hello, " << arg << '\n';
}

auto
fp11() -> void (*)(const std::string&)
{
return f0;
}

void (*fp03())(const std::string&)
{
return f0;
}

int
f1()
{
return 42;
}

int
f2(std::string str) noexcept try {
return std::stoi(str);
} catch (const std::exception& e) {
std::cerr << "stoi() failed!\n";
return 0;
}

int
main()
{
f0();
fp11()("test");
fp03()("again");
int f2(std::string);
std::cout << f2("bad12") << '\n';
}
>>
>>62061457
And people actually defend this language.
It's baffling.
>>
>>62061457
> fp11() -> void (*)(const std::string&)
what is this
>>
It's kinda funny after all these years, all the books and tutorials I read on c++ tried to instill this fear of pointers and templates on me. Now that I've programmed for so long, I realize how silly it all was, and that the only thing that made it seem scary was the worse case scenarios or basically being a dumbass, and then all the silly syntax with the archaic font being used at the time. It's just typical variables and generic types to allow you to not have to define different procedures for different data types. I know it should sound obvious, but just a "Oh, right" moment for me.
>>
>>62061471
heh, noob
>>
>>62061471
A function returning a function pointer

>>62061457
What even is happening in f2 though?
>>
>>62061483
> A function returning a function pointer
But isn't
>void (*fp03())
this a function returning a function pointer as well?
>>
File: scr.webm (2MB, 1120x682px) Image search: [Google]
scr.webm
2MB, 1120x682px
>>62058143
>What are you working on, /g/?

A top secret program written in a top secret programming language.
>>
>>62061559
Could you post the whole code?
>>
Can you guys help?
I need this function to return 1 or 0. This is the best solution I came up with.
 
int
leap(int year)
{
int a;
if (year % 4 == 0 || (year % 100 == 0 && year % 400 == 0))
a = 1;
else
a = 0;
return(a);

}



but it feels messy. I tried putting if inside return but it wouldn't compile
>>
>>62061678
int
leap(int year)
{
return year % 4 == 0 || (year % 100 == 0 && year % 400 == 0);
}
>>
>>62061678
You could do
return year % 4 == 0 || (year % 100 == 0 && year % 400 == 0) ;
. Also, I suspect your code to be wrong when it comes to calculating leap years, although I'm not entirely sure.
>>
>>62061678
If something is a multiple of 100 it's also going to be a multiple of 400, m8.

int
leap(int year)
{
return year % 4 == 0 || year % 400 == 0 ? 1 : 0

}
}
>>
>>62061678
int
leap(int year)
{

if (year % 4 == 0 || (year % 100 == 0 && year % 400 == 0))
return 1;
return 0;

}
>>
>>62061711
I think the ternary expression is not needed.
>>
>>62061705
>>62061708
>>62061709
>>62061711
>>62061724
I see now. Holy shit I'm retarded. I tried putting if inside return. Thanks guys.

>>62061711
>If something is a multiple of 100 it's also going to be a multiple of 400
That too, damn. I'll have to figure that out on my own
>>
>>62061734
Some systems might re-define 0's and 1's
>>
>>62061769
That's not it works, mate.
>>
>tfw people start following your project on github so you have to stop using words like cunt or nigger for debug instead of foo bar
feels bad
>tfw you you accidentally commit debug messages with racial slurs in them
I sure as fuck hope nobody pulled the repo before i pushed the ammend
>>
>>62061836
I'll make sure it's clean, what's the repo?
>>
>>62061763
You will forever be treated as a retard in C/C++ land, anon. Join the Rust cult :^)
>>
What license do i need to use if my project is open source and i want it to be free but i don¨t want anyone to make any money from any part of the project?
>>
>>62061858
GPL
>>
>>62061858
GPL but remember anyone could include your code in closed source software
>>
Lol, brainlets, let me give you a hint
#include <iostream>

int f1();

void f0(const std::string& arg = " function. (default arg)") {
std::cout << "\"" << __PRETTY_FUNCTION__ << "\"" << arg << '\n';
}

auto fp11() -> void (*)(const std::string&) {
return f0;
}

void (*fp03())(const std::string&) {
return f0;
}

int main() {
f0();
fp11()(" <== function.");
fp03()(" <== function.");
}


I don't even use C++ these days
>>
>>62061858
GPL but the Chinese will still probably steal your code anyway.
>>
>>62061888
You can't prevent theft so why bother?
If your source is open people will steal your shit.
If you source is closed people will pirate your shit.

FLOSS is the way to go, not cat and mouse chase.
>>
>>62061850
>Array of unspecified size, of pointers to functions that return pointers to functions that return void.

In languages with trailing return type this is easier to define, e.g.:
let f: &[fn() -> fn() -> ()];
>>
How do I load images in scheme to do the picture section of SICP?
>>
>>62061937
kek
>>
stupid brainlet question: why aren't there as many 3D libraries/engines/etc in C as there are in C++?Is it just because of the oop & other language features or just people feeling that it's harder to code in a more restrained language?
>>
>>62061836
there is no more place for racism in this world. go back to your cavern.
>>
>>62061950
c is an obsolete programming language, no one want to deal with it anymore except when being forced to.
>>
Why does GCC suck so much?
Stallman insists on making it inconvenient for tool development. So it sucks in every aspect aside from optimization and now they're slipping:
https://youtu.be/w5Z4JlMJ1VQ?t=2409

I'll give GCC 2-3 years tops. When you're beat by intels compiler you should reconsider your place in the world.
>>
>>62061937
lmao priceless
>>
>>62061946

plz no bully
>>
>>62061968
i wouldn't say it's obsolete, many compilers still have to implement all c11 standards
>>
>>62060020
and you think those portable libraries don't use platform specific code, you dumbass? You think stuff like the SDL is magically able to open a window on any platform? Of course it uses the Win32 api on Win32, X on systems that use X, the cocoa api on OSX, etc.
>>
>>62060263
I find it pretty and surprisingly readable.
Modern Fortran:
http://people.ds.cam.ac.uk/nmm1/fortran/
Good example of a well written Fortran program: https://github.com/wannier-developers/wannier90
>>
>>62061988
>>62061946

Nvm got it, dab on the haters.
>>
>>62061910
Yes you can. Run your code on a server and provide remote paid access only
>>
>>62058512
>>62058522
>not going into academia
>>
>>62062109
Might as well don't sell the software at all
>>
>>62061950
They think that they have to use OOP and C++ is only language those people might know well.
Usually if the engine is written in C it has comment like this somewhere
>There are plenty of C++ engines which do what I've done here and better. Pure C game engines on the other hand are much rarer. Corange provided me an outlet to practice my C skills. Of course if you are just linking to it you can still program your game/executable using C++.
Or other reason to use C
>Orx is mostly written in C (with some plugins in C++/Obj-C) but allows you to develop with it with any language that can interface to C (like C++ or Objective-C for example).
There's also that thing that C doesn't provide data structures in the standard library but I think this is not the reason because most C++ engines seems to implement their own data structures.
>>
Is there any reason to use a Makefile over just running a bash (or whatever sh) script that compiles your shit?
>>
>>62062289
make run task in parallel, also people are familiar with just getting the project and running make and except it to work
>>
>>62061950
>why aren't there as many 3D libraries/engines/etc in C as there are in C++?
Because the game industry is culturally dominated by C++.
https://youtu.be/rX0ItVEVjHc?t=5027
>>
>>62062420
well no shit, that's what i was asking: the reason for it: is it just because the "lack" of features or because it's easier to use already-made data structures that benefit from oop/other things
>>
File: out.gif (2MB, 960x576px) Image search: [Google]
out.gif
2MB, 960x576px
Is this intuitive?
>>
>>62062484
Sorry. My bad. I'd say it's just a very general trend and the fact that games require a lot of developers. C++ projects with less experienced developers do scale better than C projects with less experienced developers.
I also think that because the games industry was dominated by C before (as an engine language, large variety in scripting languages) contributes too. The promise that you can write C code in C++ makes it a much smaller leap.

If the games industry was Cobol/ada/basic/whatever dominated in the past they'd probably have made a completely new language instead of getting on the C++ bandwagon. It's also worth noting that a lot of industries have very senior staff, the games industry has a comparatively young staff.

Object oriented programming was also widely used in games before when the game designs were very limited in scope. Most actual engine work is not object oriented anymore. It's just a common paradigm for newbies so you find that stuff in the surface level APIs for stuff like Unreal or Unity.
I also personally believe OOP scales well with inexperienced developers. The style seems to encourage very large fragmentation of code.
>>
>>62062538
also, since you're talking about game engines, both the game and the engine is being written in C11
>>
>>62062573
Put a sample gist of your source, of the game
>>
>>62062626
It's over 2000 lines of steaming pile of shit.
#include "dg.h" // we include this because in the future (tm) g.h will only have the types
#include "g.h"

/// FIXME: ejectors are buggy as hell (5.lvl)

/// TODO: sticky hero mode
/// TODO: shrinker max size
/// TODO: pulsator max size (also integrate into script generation)
/// TODO: add g.cfg.camera.dampening

int main(void) {
dgInit(BATCH_SIZE);
Level level = scanLevel(LEVEL_PATH);
initGameData(scanConfig(CONFIG_PATH), level);
freeLevel(level);

float lastTick = dgGetTime();
while (!dgMustExit() && !g.lvl.over) {
dgLoopInit(g.lvl.bgClr);
if (dgGetTime() - lastTick > g.cfg.tickDuration) {
tick();
lastTick += g.cfg.tickDuration;
++g.lvl.ticks;
}
draw();
dgLoopExit();
}
printf("%ld\n", g.lvl.ticks);

dgExit();
exitGameData();
}


I like it anyway.
>>
File: Brazil2.png (108KB, 450x557px) Image search: [Google]
Brazil2.png
108KB, 450x557px
>tfw my boss and I had a discussion -- and I convinced him to use OOP over functional programming for a critical task
>>
>>62061883
Where ma boy
int f1()
defined at
>>
>>62062710
whoa.....
>>
>>62062710
Do you work for human traffickers?
Why would you afflict them like this?
>>
>>62062863
>the 'OOP is bad' meme
t. neet who never had a job
>>
>>62062710
How come boss wanted FP for a task?
>>
>>62062710
what was that critical task?
>>
>>62062710
>critical OOP
lol it sure is critical that our widget has a class
>>
>>62062710
>I actively made our codebase worse

Good job? Do you shit under your chair too?
>>
What projects do you guys use c++ for?

I mostly end up using java/kotlin despite really liking c++ as they're more appropriate for the project (trading bots, server stuff, apps etc).
>>
r8 my parity checker
_find_error:
push esi
mov esi, [esp + 8]
mov ecx, [esp + 12]
jecxz endloop

mainloop:
lodsb
test al, al
jp end
loop mainloop

endloop:
xor esi, esi

end:
mov eax, esi
pop esi
retn
>>
>>62058711
saber is cute
>>
I'm going through the Tour of Go, slices exercise.

package main

import "golang.org/x/tour/pic"

func Pic(dx, dy int) [][]uint8 {
result := make([][]uint8, dy)
for i := range result {
result[i] = make([]uint8, dx)
for j := range result[i] {
result[i][j] = (uint8(i) ^ uint8(j))
}
}
return result
}

func main() {
pic.Show(Pic)
}

Where are dx and dy arguments passed? I don't see where they are.
Also, I don't get the idea of explicit type conversion of INTEGERS. What's so great about that?
>>
C++ is quite inconsistent about its own rules
#include <cstdio>
#include <string>
#include <functional>
using namespace std;

void print(string arg = "test") {
printf("%s\n", arg.c_str());
}

int main(void) {
function<void(string)> p = print;
p("sdf"); // works
p(); // won't
}
>>
>>62063294
Never touched a single line of Go in my life but I think you're passing the function Pic to the function pic.Show() which then takes care of passing dx and dy to Pic.
Explicit type conversion means no surprises. Some people like it, some don't.
>>
>>62058143
Taking a shower after waking up covered in semen.
>>
>>62063150
>using a stack
B L O A T E D
L
O
A
T
E
D
>>
want to go through a kotlin for android tutorial but keep doing something else instead

sigh
>>
>>62063318
You defined p to be a function with one argument; It's proper to not let you call it with zero.
>>
>>62058143
So as a hobby, what do you actually program? I fell for the CS meme and did a year of Java before dropping out because of boredom.
>>
>>62062289
Makefile makes it feasible to only do a part of the work; your bat file will generally have to compile everything (unless you emulate make functionality in bash, which you very well may, but why?)
>>
>>62063440
But he defined a default argument, didn't he?
>>
>>62063573
For the function named print. He's not calling print. He's calling p, which is defined as a function with one argument. He can call print with zero arguments just fine.
>>
>>62061883
>>62061457
I'm new to C++ but why not use std::function?
std::function<void(const std::string&)> fp1000() {
return f0;
}
>>
>>62063599
p points to print
>>
>>62058237
how is phoenix?
>>
>>62063617
Imagine you create an std::string variable, and then an integer pointer pointing to it. You then would try to assign a string to that integer pointer. Would you also be surprised? Would you argue that since the pointer points to string that assignment should work?

     std::string s;
int *pointer = (int *)(void *)&s;
pointer = "hello"; // WTF C++
>>
File: 1474325315193.jpg (44KB, 636x616px) Image search: [Google]
1474325315193.jpg
44KB, 636x616px
Employed Haskell programmer reporting in
>>
>>62063868
What line of work are you in?
>>
>>62063899
STOP REPLYING TO BAIT
>>
>>62063943
I didn't know it was bait.
>>
>>62063951
Then lurk more, because she posts this almost every thread.
>>
>>62063965
But I want to participate.
>>
>>62063980
cute
>>
I am a fucking retard and messed up my Computer Science application, chances of me getting in this year are extremely slim.

I only know C basics.
Is it possible for me to learn C and C++ on my own to get internship so I can do something until next year while I wait to apply for CS again? If yes how long would it take me if I can dedicate 10 hours a day practicing and learning C/C++?
>>
>>62064425
That's a stupid question that no one can answer. It entirely depends on the pace that you can absorb knowledge at, some people are retarded and don't know how to learn and/or cannot wrap their heads around some concepts that are trivial so it naturally takes them longer to learn than for someone that actually learns properly.
>>
>>62063868
tfw just did a comfy refactor on some code that bothered me in client's codebase for few weeks now

Haskell refactors are the best
>>
>>62058143
>What are you working on, /g/?
Just finished writing a small audio library on top of OpenAL for my project, works pretty well.
>>
Ok, so I'm quite new to Android programming, and I want to fetch a RSS feed as soon as the app starts.
Do I do this with a service in the background?
>>
File: 4bRLCB7.jpg (227KB, 1156x1156px) Image search: [Google]
4bRLCB7.jpg
227KB, 1156x1156px
Quick rundown on WebRTC? My mate told me to implement a PeerJS API in java, but it seems to me that I would need a java WebRTC library in order to do that. Is there such a library that we could use in our proprietary app, or do I have to make one myself? If so, would it be feasible?
>>
>>62064464
I understand.
But then theoretically would anyone take me on internship if I manage to "learn" languages on my own without any higher education?
>>
>>62064555
For something so small you can just use retrofit. You don't need a service for such a short lived task.
>>
>>62064610
Probably a slim chance when it comes to C, you'd be much more likely to get an internship while being new in some higher level language but still if you've got nothing going for yourself (like a degree/formal experience) then your best bet is implementing some interesting stuff and putting it up on GitHub, it won't guarantee that you land an internship but it'll definitely boost your chances a lot.
>>
Anybody got any good links for starting with C++???
>>
In android how do i launch a specific activity in different app? Like if i want to open the settings tab of facebook for example
>>
>>62058198
kek'd
>>
File: 1485993818724.png (167KB, 1920x1080px) Image search: [Google]
1485993818724.png
167KB, 1920x1080px
>>
>>62064681
They should at least call it fn, auto is misleading, auto is hiding nothing, it's just a placeholder
>>
>>62064681
the real shitpost is maketriple and makedouble performing IO
>>
>>62064709
>They should at least call it fn
yes, pack even more stuff in that giant language
>>
>>62064776
fn makes more sense than auto
>>
>>62064681
>Rust has fn syntax
>autists cry about it
>C++ has auto syntax
>It's okay, we won't mention it
>>
>>62064425

You can't do ten hours a day, not possible without burnout. I'm good at studying and my max is probably 5 before I devolve into brain fog or inefficincy.

Unpragmatically, around 1 month of '10 hour' will give you solid foundation in C. Another month for C++ and then 3+ months to be useful.
>>
>>62064786
yes, but why would you add one more keyword such a simple feature
>>
>>62064799
who are you quoting
>>
>>62064809
wtf would you rather use misleading keywords instead?
>>
>>62064829
I'd never use auto this way in the first place, I don't see why I'd drop the type from the front, if I have to write it at the end
>>
>>62064917
The new syntax may look like a step backwards in readability for the usual function declarations, but it does make it possible to use decltype to specify template function
return types:
template < typename T1, typename T2 >
auto Foo(T1 t1, T2 t2) -> decltype(T1*T2)
{
...
}


The problem that’s addressed here is that T1 and T2 are not in scope before the compiler
reads the eff parameter list, so any use of decltype has to come after the parameter list.
The new syntax makes that possible. Almost all modern languages have this feature.
>>
>>62058780
prolog was better
>>
>>62060554
funny
>>
>>62061559
racket can do GUIs that like kinda ok... already beats tcl
>>
>>62062893
t. pajoot
>>
>>62065084
yeah
https://docs.racket-lang.org/gui/index.html
>>
>>62065084
only for desktop operating systems. Can't even exports as apk for android. Racket is so shit.
>>
>>62058976
please help
>>
>>62065227
Cairo propably needs pointer to opengl context are something like that. See if libui has function for getting the native drawing context of the window.
>>
>>62065299
ok thanks
>>
>>62058746
C++ can do OOP; don't get pedantic, it's not fucking worth it.
>>
>>62065084
racket/gui backends are

windows: winapi/gdi or gtk
macos: cocoa
rest: gtk
>>
>>62061709
That is how you calculate leap years.
>>
>>62058741
>No HDL
Survey is shit.
>>
>>62063318
That seems completely consistent.

p is a function of expecting a string, there is no default. p is not a function pointer...

Please explain why this is not consistent?
>>
>>62063654
What? Are you asking a question or making a statement?
>>
I'm trying to get audio to work on mobile Chrome. I have a button set to play the audio and start a timeout, but the audio never plays.
The site works fine on desktop and Chrome's mobile emulation, pls assist
>>
>Attempted to learn C++
>Modern C++ annoys me
>Want to learn one of the """""up-and-coming competitors""""" like D or Rust
>Know in my heart of hearts, I'll only ever get to use those languages in hobby projects, and never a job

Are C++ jobs even fucking worth it?
>>
>>62065639
Maybe you denied the permission for the app to play audio?
>>
>>62065672
It's an HTML page with some JS, so that shouldn't matter unless Chrome devs were retarded enough to forget that tiny detail
>>
>>62065701
try chrome://flags/#disable-gesture-requirement-for-media-playback in the url bar first
>>
I've spent plenty of time using linux/unix, but never set up anything or installed anything myself. What versions should I try out in a VM if I plan to only use it to program in C and SystemVerilog with emacs, and maybe grab ModelSim?
>>
>>62058143
Am developing a C Win32 client.

Need to manage all kinds of signals/events, both keyboard ones and server disconnections or stuff like that.

Can't find a decent MSDN or anything that explains how to properly manage signals in Windows, can you guys help me find some useful documentation about it?
>>
>>62065722
Apparently it works on Android phones, so it's just an iOS issue. I hate web dev. Thanks for the help.

>>62065725
Debian
>>
Thoughts?

PROGRAM CubeRoot
USE double
IMPLICIT NONE
REAL(KIND=DP) :: target, result
INTEGER :: i, k
mainloop: DO
PRINT *, 'Type in a real number'
READ (*, *, IOSTAT=k) target
IF (k < 0) THEN
STOP
ELSE IF (k > 0) THEN
PRINT *, 'Some sort of horrible I/O error'
STOP 1
END IF
IF (target .EQ. 0.0_DP) THEN
PRINT *, 'The cube root of zero is, er, zero'
CYCLE
END IF
result = Newton(target)
PRINT *, result, result**3
END DO mainloop

CONTAINS

FUNCTION Newton (source)
REAL(KIND=DP) :: Newton
REAL(KIND=DP), INTENT(IN) :: source
REAL(KIND=DP) :: current
REAL(KIND=DP), DIMENSION(5) :: previous
!
! This is cheating, but the hardest part of Newton-Raphson solution of
! Nth roots is getting the starting value, and doing so properly would
! merely be confusing. So use a horrible hack to get an approximation.
!
current = 1.1*CMPLX(source,KIND=KIND(0.0))**0.3
DO i = 1,5
previous(i) = 0.0_DP
END DO
loop: DO
current = current - &
value(current,source)/derivative(current)
PRINT *, current
DO i = 1,5
if (current .EQ. previous(i)) EXIT loop
END DO
DO i = 1,4
previous(i+1) = previous(i)
END DO
previous(1) = current
END DO loop
Newton = current
END FUNCTION Newton

FUNCTION value (arg, targ)
USE double
IMPLICIT NONE
REAL(KIND=DP) :: value, arg, targ
value = arg**3-targ
END FUNCTION value

FUNCTION derivative (arg)
USE double
IMPLICIT NONE
REAL(KIND=DP) :: derivative, arg
derivative = 3*arg**2
END FUNCTION derivative

END PROGRAM CubeRoot
>>
>>62065886
>end
>::
>CAPS LOCK IS CRUISE CONTROL FOR COOL
It's shit.
>>
C noon here. Don't know how people format code irl for readability.
I'm writing a program where I need amount of days in each month for later calculations.
Is it aesthetically ok to #define 12 constants under #include? (they're called constant macros right?)
>>
>>62063318

Please do not pass std::string objects by value. You are unnecessarily copying data.

>>62063617

Think of print like two functions with the same name (completely legitimate in C++; it's called function overloading). One takes 1 argument, the other takes no arguments. You made p point to the one that takes 1 argument.
>>
>>62065886
I forget my Fortran so I can't tell off the top of my head what version you're using, but unless you specifically have to hobble yourself to old version you should be using Fortran 2008. Caps lock isn't necessary since Fortran 90 I think
Also unless you need the entire history for a purpose, you shouldn't need to use an array to keep track of the previous value, single variable is enough.
Oh and testing doubles for equality is a bad idea, always use tolerances (ie, abs(target - current) < tolerance)
>>
>>62060437
nah
best to make the plunge to full oop
>>
>>62066003

It's aesthetically okay to #define as many constants as you want. Just be aware of where it might make more sense to use an enum.
>>
>>62061850
in haskell this is just
f :: [IORef (a -> IORef (a -> ()))]
>>
I don't understand lambda calculus.
>>
>>62065816
Bump. Please someone with any Pajeetdos C knowledge help me
>>
>>62065647
If you are a good programmer, both D and Rust will get you a job.
>>
>>62060510
>and whos also switching to a type system
clojure had a type system from the first version, what are you talking about
>>
File: aes.jpg (53KB, 642x624px) Image search: [Google]
aes.jpg
53KB, 642x624px
r8 my /aesthetic/ code
>>
>>62066325
Are you a retard?
>>
>>62066008
>You made p point to the one that takes 1 argument.
So print will point to the function with matching arguments. Is there a way to have p point dynamically as well? And if there isn't, how does one set a pointer to point to the no argument function?
>>
>>62066248
Imagine naming a programming language after the effect of neglecting something...
>>
File: 1476120845949.png (6KB, 321x321px) Image search: [Google]
1476120845949.png
6KB, 321x321px
>>62066325
>>
>>62066325
Thumbnail reminded me of >new averaging method
>>
>>62066325
Why not just enum the months to have integer values equal to the amount of days past? Even if you uses months else where, just enum months as the amount of days they have and make a second enum with an additional letter for total days.
>>
>Beethoven
>influential

LOL Beethoven hasn't released any new music in hundreds of years. Not influential at all. Besides who the fuck listens to shitty classical music anyways
>>
>>62066362
Did they ever announce the reasoning behind their name? I get the theme they're going with their naming conventions (Rustaceans, Cargo, etc.), but why Rust?
>>
>>62066501
From wikipedia:
>The language grew out of a personal project started in 2006 by Mozilla employee Graydon Hoare,[11] who stated that the project was possibly named after the rust family of fungi.[27]
>>
>>62066501
Rust is named after a very resilient kind of bacteria that has like three ways of duplicating itself. It kinda follows the idea of having a safe and resilient language.
>>
File: mexico warning.png (25KB, 300x57px) Image search: [Google]
mexico warning.png
25KB, 300x57px
>>62065886
>
DO i = 1,4
previous(i+1) = previous(i)
END DO

I don't know Fortran, but doesn't this fill previous with previous(1)?

Also nice captcha
>>
>>62066325
Is FEB a constant?
How do you treat leap years?
>>
/g/ never took any science classes did they. No wonder some of them are even religious
>>
I really want to program my own projects more often. I also have a long list of things related to programming that I want to learn. But when I come home from work, I no longer have the energy to do anything productive so I succumb to anime and gaymes. Please help. Jobs suck. I don't want to work for a corporation and sit in an office 8 hours a day, but goddammit, how else do I make the money to eat and live? Should I trade or mine some memecoins and try to live with that money? No thanks, too risky. What do?
>>
>>62066561
Become a robot. Eat a ton of sugar when you get home in order to boost your brain and make sure you always get at leas 9 hours of sleep per day.
>>
File: everything makes sense now.png (204KB, 1206x420px) Image search: [Google]
everything makes sense now.png
204KB, 1206x420px
>>62066526
>Rust fungi are highly specialized parasites with several unique features.
>Unlike other plant pathogens, rust usually affects healthy and vigorously growing plants...

Is Mozilla that self-aware?
>>
can a brainlet who can't into math learn programming?
>>
>>62066543
 
if (leap(year) == 1 && month >= 3)
year_day = year_day + 1;

and
int
leap(int year)
{
int a;

if (year % 100 == 0 && year % 400 != 0)
return (0);
else
return (year % 4 == 0);

}

>>62066451
I don't know what that is yet.
>>62066340
may be
>>
>>62066325
year_day = 0;

switch( month ) {
case 12: year_day += NOV;
case 11: year_day += OCT;
case 10: year_day += SEP;
case 9: year_day += AUG;
case 8: year_day += JUL;
case 7: year_day += JUN;
case 6: year_day += MAY;
case 5: year_day += APR;
case 4: year_day += MAR;
case 3: year_day += FEB;
case 2: year_day += JAN;
case 1: year_day += day;
break;

default:
puts("Enter correct month number.");
}
>>
>>62066606
Yes, the "you need math to program" myth is but a meme.
>>
>>62066606
No, otherwise you are going to think that fizzbuzz is OMG MATH
>>
>>62066623
close, but you always have to add day
>>
>>62066613
int a;
is not supposed to be there
>>
>>62066606
you at least need category theory
>>
>>62066606
Yes. I'm a brainlet who can't into maths and I wrote several compilers.
>>
>>62066665
For what?
>>
>>62066643
>fizzbuzz
speak english or i'll bash you, last warning.

>>62066633
excellent, I'll start tomorrow
>>
>>62066650
It is. The lack of breaks means it flows through. (The only reason to ever use switch statements in my opinion.)
>>
>>62066650
There you go. I thought year_day had to be initialized to something.

year_day = day;

switch( month ) {
case 12: year_day += NOV;
case 11: year_day += OCT;
case 10: year_day += SEP;
case 9: year_day += AUG;
case 8: year_day += JUL;
case 7: year_day += JUN;
case 6: year_day += MAY;
case 5: year_day += APR;
case 4: year_day += MAR;
case 3: year_day += FEB;
case 2: year_day += JAN;
case 1: break;

default:
year_day = -1;
puts("Enter correct month number.");
}
>>
>>62066606
you can become a codemonkey writing enterprise software or doing webshit very easily, that's almost blue collar work, not much brain is needed
>>
>>62066704
>speak english or i'll bash you, last warning.
Go with your English Literature Degree to other place, brainlet.
>>
>>62066665
>category theory
i got bored reading the wikipedia description of this
>>
>>62066733
>to other place
grug mad you insult him words
>>
>>62066731
>that's almost blue collar work
very true. enterprise and webshit sometimes feels like a skilled laborer duing the middle ages carving details into the sistine chapel
>>
>>62066743
It's completely useless, that anon is memeing.
>>
why does haskell need a gc?
couldn't it have lifetimes like rust does?
t. brainlet
>>
>>62066769
to piggyback off this anons question, is Haskell a meme language?
>>
>>62066769
You can't just ask fucking retarded question and then go full retarded with >t.brainlet
Ask your fucking question. We will call you faggot regradless.
>>
>>62066794
Yes.
>>
>>62066817
>t. brainlet
>>
File: you.jpg (11KB, 238x212px) Image search: [Google]
you.jpg
11KB, 238x212px
>>62066833
>being this mad on internet
>>
How do I into actual output?
So far all we have been doing with C in school just opens black .exe window. How do you make something else?
>>
>>62066846
>t. brainlet
>>
>>62058847
Give a single (1) reason why R is better than python for anything.
>>
File: pelles-c_windows_3.png (137KB, 1024x728px) Image search: [Google]
pelles-c_windows_3.png
137KB, 1024x728px
>>62066850
Install Pelles C. Pic related.
>>
NEW THREAD!!

>>62066877
>>62066877
>>
>>62066869
If you use R studio you can do all your stuff in GUI without ever having to bother writing line of R code.
>>
>>62066883
Too soon. Ignore this.
>>
ACUAL NEW THREAD MADE AFTER BUMP LIMIT
>>62066906
>>62066906
>>62066906
>>62066906
>>
>>62066869
that fucking retarded whitespace shit, for the quickest thing
R has more packages I actually need, and CRAN is an exceptionally good repo system
>>
>>62066883
Dumbass
>>
>>62066869
python's """""lambdas""""" are pig disgusting trash pukes
>>
File: what is wrong with this.png (19KB, 732x438px) Image search: [Google]
what is wrong with this.png
19KB, 732x438px
why wont this work??
i want to download youtube videos into mp3 by typing
youtube-dl link-to-youtube

but i keeps telling me that the requested format is incompatible for merge.
>>
>>62067304
dumb akariposter
>>
>>62066230
Bump
>>
>>62067304
I've been having the same problem anon
>>
>>62068241

apparently you have to save the file as youtube-dl.sh file so that it can appropriately understand $1 or something

just add '.sh' and it should work, although now you have to do
./youtube-dl link
instead of just
youtube-dl link 
>>
>>62068783

woops, it should be
 ./youtube-dl.sh link 
Thread posts: 321
Thread images: 33


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