/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

github.com/jsoftware/jsource/blob/master/jsrc/v2.c
strawpoll.me/12097496
github.com/openj/core/blob/master/ar.c
reddit.com/r/programming/comments/5nes00/the_j_source_code_is_pretty_terrible/
stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list
youtube.com/watch?v=_DTpQ4Kk2wA
esr.ibiblio.org/?p=7294.
amazon.com/WORTHINGTON-CYLINDER-CORP-347138-Disposable/dp/B000RHMWBQ/ref=pd_sim_21_3?_encoding=UTF8&psc=1&refRID=DRJ0V0VY1XZRDAXHAMJZ
en.wikipedia.org/wiki/JavaOS
programatica.cs.pdx.edu/House/
intoverflow.wordpress.com/kinetic/
eta-lang.org/
twitter.com/SFWRedditVideos

Iverson did nothing wrong

Friendly reminder that if you don't use chinese characters for variable names then you're not a real programmer

...

Thanks for using an anime image faggot

>Any good video to learn C structures and linked list from?
>I've been trying for two days now and still haven't figured it out.

asking again

I'm making a taskwarrior clone/inspired task manager.

It works pretty well even though I totally cannot into databases and my current JSON processing is probably inefficient as shit.
Now just improve the CLI parser and then maybe web interface

There is no anime image faggots, there are only anime image (pure) girls.

>You sure are making a lot of generalisations about a lot of code.
I've seen a lot of code in my time and C code bases seem to be by far the most stuffed with things like this.

It might be a somewhat unfair sweeping judgement, but my post was prompted by my being triggered by seeing this undocumented function in some (proprietary) C code:

bs_isec(bset_t **res, bset_t *bs, uint32_t bs_n, bs_idx_t rgn_s, bs_idx_t rgn_e)

I offer a (You) to whoever figures out what it does based on just the above.

Sorry, how it actually looks is:

int bs_isec(bset_t **res,
bset_t *bs,
uint32_t bs_n,
bs_idx_t rgn_s,
bs_idx_t rgn_e);

Context is important, this would only be bad if the workings cannot be easily inferred from the context AND variable name.

Just studying these days and doing simple class projects (Intermediate Java Programming and Software Security) and studying for the Network+ exam in March. Here are the books I'm working through.

Same reason why printed text is best divided into columns you dumbos.

Hint: your eye can see the entire line at once.

It's a part of the public interface of a library.

result
set
set element count
region start
region end

>on just the above
that's a stupid condition

Reminder that pretending to be an Anime girl boosts your programming skills by 50%

Why? Should I have to look up the internals of every function I see used?

Does she run Gentoo?
Why there is no anime girl wallpaper?

Close but not entirely correct.

What do you think it does?

is sponge bob an anime girl

Has anyone read C++ primer or cpp primer plus?

Which book for C++ does Sup Forums recommend?

Post code that is objectively terrible, i.e. unreadable even for a language expert.

I'll start:
github.com/jsoftware/jsource/blob/master/jsrc/v2.c

>reposting the J source
It looks like J/APL. It's just how they like their code.

>I can't read code unless it uses that I approve
fucking python babby.

>hurr hurr readability is subjective and everyone is a special snowflake
Most style debates are a waste of time, but some things are objectively shit.

strawpoll.me/12097496

What target and options should I use for building GCC and Binutils for building for the GBA?

>github.com/jsoftware/jsource/blob/master/jsrc/v2.c
the fuck? is it obfuscated/minified?

im finishing my CS degree but my classes have all a very web dev context to it and i'd like to work in companies that do space/military kind of work, what projects should I try and do on my spare time to look good on job interviews?

i want to punch whoever wrote this shit

github.com/openj/core/blob/master/ar.c

>not valuing job security

Probably

Why do you care. It's not like you are going to program anything in C anyway.

reddit.com/r/programming/comments/5nes00/the_j_source_code_is_pretty_terrible/

intersection of two binary sets
uses first argument as both input set and result

CAN'T. BREATH. SIDES. ORBIT.

According to this post stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list "cpp primer plus" is a pile of horse manure. I did not read it but I read "C primer plus". It was not that bad since C did not change much. But I could clearly see that Prata that did not update his book much since the '80. His code examples are horrible. You can this it's-a-compiled-language-no-one-will-see-your-shitty-variable-names-anyway philosophy.

I've been asking this myself. I can't believe anyone writes like this natively.

youtube.com/watch?v=_DTpQ4Kk2wA

I got memed yesterday with fizz buzz on a job interview.

AMA.

how badly did you fuck up?

Did you get hired?

Were you able to complete it?

Not that bad. I feel like it actually went ok, but that I could have done better (overall)
Not yet. I met with 5 different people, and I'm waiting for them to meet and make a decision.
Within 5 secs.

I teach some programming and every year I get a couple of students who will spend an hour or two writing hundreds of lines of (very buggy) code without thinking twice or testing once. Then they get to try and run it, which ends in a much longer effort to untangle and debug the mess they have wrought.

Various students have different problems and I can assist them with most, help them understand various concepts etc.

But these people I just don't understand and I find it very hard to help them. Why do my comments that it's better to go bit by bit testing along the way not reach them? Those people do it repeatedly even after getting the same spiel from me over and over. Most of them are not even dumb people.

Did anyone on here ever go through such a phase? Can you explain me what went down in your heads?

anyone pls

webdev is the purest form of programming

tldr linked list:
in your struct of data, have a backwards pointer and a forwards pointer.

if that doesnt give you a clue go learn more about memory.

also linked lists are inefficient fyi

go read effective c++, and the books following that.

>user doesn't know how memory works
>expects user to know how cache works

lmao woops

Most people are stupid.

Punish and reinforce the point.

t. Teacher.

t. child abuser

More lines = more (apparent) effort = bigger ego.

When I was in high school, my peers and I used to consider a larger LOC count to directly imply a larger and more complex program.

Now we were after ego - we didn't run to our teacher when our stuff didn't work, so I'm not sure this is like your situation.

Have you considered enforcing stronger restrictions on the assignments, that would promote smaller LOC count and more frequent testing? My one prof did this - he gave us a header file for a specific data structure. Our implementations were naturally smaller, and we could test them individually with a test file he gave us. It also was not entirely covering all of his test cases, which he told us so that we would think on it ourselves. You could do something similar, but add penalties to deter them from writing larger complex pieces of garbage.

Just my 2 cents.

It's easier to address a problem when I understand how it arises.

Punish through lowered grades.

>low grades are punishment these days

it's like a chain

You'll find that given 30 students, there will be 31 reasons for not understanding something, taking up the entirety of your time, and initiating your descent into madness.

are you using an IDE which points out syntax errors? because you should

are you starting them off with simpler tasks first?

it should be obvious to them right from the start that they need to focus a lot on writing code carefully and testing it often. if you get just one character wrong, the program is wrong.

I got your back


#include
int
main
(void)
{
printf
("Hello ");
printf
("world!\n");
return
0;
}

FizzBuzz in Ada

beautiful

Alright /dpt/ I need help
I decided I'd start learning Java because why not, and I'm now going through generics
So, I tried to create a generic list that can be used to contain generic lists and so on, like:
List eldritch;

That's obviously unfeasible, so I thought that wildcards might help
List eldritch;

Which looks nice, until you have to instantiate it
List eldritch = new List();
I really don't know what I'm suppossed to place at ____, it's not a wildcard, that's for sure, and I'm way to scared of raw types to just do new List

How the fuck do I do this

>tfw hearing arrogant students talking shit about haskell with nasally voices and "i just want to make money man" in lecture

You just could show them big lists of C code and present "In Haskell, it's just..."

Swap to Haskell

data List a = Null | a :> List (List a)


l = 3 :> [3,4,1] :> [[4,7,3], [4,3,6], [7,5,3]] :> Null

>muh haskell

Go away, Curry nigger.

>Pajeet mad that Java will be replaced with a language he can't learn

>delusional neckbeard thinks haskell is hard to learn and that's why it's unpopular and not because it's a terrible language

I'll just leave this here: esr.ibiblio.org/?p=7294.

Java is popular and a terrible language

QED

I'm not even the javafag. I'm just sick of hearing about your GB of garbage per/second generating pile of shit you call a language. You monad cult fuckwits need to be gassed.

>Java is popular
true
>Java is popular and a terrible language
false

>using the first false criticism of Haskell you hear because you don't have any real reasons, you're just mad other people are enjoying FP languages without you

...

Sorry, this is the daily programming thread.
Programming is welcome here.

>false criticism
>admitted by the creators of haskell themselves

Oh boy, would you look at the time:

amazon.com/WORTHINGTON-CYLINDER-CORP-347138-Disposable/dp/B000RHMWBQ/ref=pd_sim_21_3?_encoding=UTF8&psc=1&refRID=DRJ0V0VY1XZRDAXHAMJZ

>implementing babby-tier data structures in haskell
>programming
have you even made anything non-trivial in haskell?

Has anybody?

>tfw two stupid to learn how to code

Everything is trivial when you write it in Haskell

...

Okay. Go write an OS kernel that runs on real hardware.

Stop tipping your imperative fedora and start learning today

While is definitely not strictly correct, just because a language can't be used to write an OS kernel doesn't make it completely useless. Java can't do that either.

I already learned enough haskell to see that it was a waste of time.

Java can?

java is shit too. It's just less shit than haskell.

en.wikipedia.org/wiki/JavaOS

>Java is popular and a terrible language
>false
True ackshually

programatica.cs.pdx.edu/House/

If we're counting OS's that only run on virtual machines (which are written in something else) then Haskell can do it too.
programatica.cs.pdx.edu/House/
intoverflow.wordpress.com/kinetic/

Why should I hire you when I can contract 5 Pajeets for half the cost and not have to worry about the feminists in HR screaming at me for hiring a white male?

...

>C replacement
it's called C++

eta-lang.org/

And? The JVM itself is okay, it's Java itself that sucks.