/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Previous thread:

Attached: 1533368190995.jpg (3840x2160, 741K)

Other urls found in this thread:

youtu.be/k06lLDDe-b4
sourceware.org/gdb/wiki/GDB Front Ends
twitter.com/NSFWRedditGif

nth for install shen

First for C

C++ is the most powerful and efficient programming language in the world

Attached: 1531101859923.png (2894x4093, 3.4M)

You were too slow on that. Time to switch to Fortran or asm for a little speed boost.

*takes 30 years and 128TB of RAM to compile GCC/Clang*

If you try to compile it on a PDP-11 maybe.

I compile GCC from source all the time.
Takes maybe half an hour and not much ram, though I didn't measure ram usage but it didn't go over my 8GB at least.

import Data.Char

alternateCase :: String -> String
alternateCase = zipWith (\f c -> f c) $ cycle [toUpper, toLower]

Attached: 1537471557115.jpg (766x864, 130K)

I have trouble with Java and UTF8 encoding. I made a small console program. When I compile it in Eclipse, the accented text is fine (wether in Eclipse or in Windows commandline).
If I compile it with javac the accented characters become garbled.

What do to compile properly with javac? It doesn't seem to be a problem of the JVM.

I compiled the entire GNU ARM embedded toolchain on a raspberry pi and it took about an hour.

JavaScript rocks!

Attached: js-rocks.png (1000x494, 368K)

Is this automated bot?
This shit is going for few months now

>Cplussies love disgusting cow tits
As expected

Disgusting.

No real idea, but there's probably a flag to tell javac what character encoding to expect for source files.

Which scripting language I should use with C?

C++

zipWith id

Chicken Scheme.

fuck off Bjarne, nobody likes you.

I always hear it to this beat
youtu.be/k06lLDDe-b4

the state of C++

Attached: _.png (737x412, 44K)

lua

Neat, didn't know that works

>array indexes start from 1
lua is not programming language

...

you said scripting language dumbass

id f x = (id f) x = f x

0 index should be empty array

I love all sizes user-kun.
You're not a man if you don't.

Attached: 1529223360475.jpg (1814x2523, 2.56M)

>17
Too old

As of C++11 this is auto RingArray::iterator::operator++(int) -> iterator&; and in C++14 it's just auto RingArray::iterator::operator++(int);

I was referring to the current C++ standard.

>C++11
>C++14
Haven't been out for 10 years, so you can't expect a C programmer to know about them yet.

I'm writing a C function that counts how many times each different character occurs in a file. Should this function take a FILE * and then reset it to its original place in the file after it's done, or should it take a char[] containing the filename?
The program is supposed to be a huffman encoder that first reads the file to build a huffman tree then reads the file again to actually encode it.

Do people use emacs in work environments which are based around vstudio & windows?

why would anyone want lua as their scripting thing when lisp\javascript exist

I am going learn go. Should I use acme, sam, or ed as an editor?

>C/Lua/Make
>C++/pybind11/Python/CMake
Those are your two options.

>just

idk it was just a suggestion

It's about as straightforward as a type signature for a function nested two classes deep will ever get.

Yes. We did in my team.

tfw no 2D tiddy monster gf

god i wish i was sagiri

I must say, IO in Java is needlessly complicated.

Attached: comfy14.jpg (1895x1272, 681K)

What am I in for?

Attached: 2018-11-05 21_21_38-lec01.pdf - [Microsoft PowerPoint - lec01.pptx] - SumatraPDF.png (800x435, 43K)

you'll get one eventually user

How was it? Does skilled emacs usage outperforms visual studio? Considering you have to work around build\debug from emacs itself

Memes

Parametricity states that a deterministic function of type ∀A. Multiset A → List A where A is a linear type MUST be a sorting algorithm.

broof-a-doodle-doo

>Does skilled emacs usage outperforms visual studio?
It's the developer who made the software, not the tool.
>Considering you have to work around build\debug
Make is our default build proces, so no problem to integrate Emacs into the build process.

wrapped it in a monad

Why is multiset important?

You'll probably learn more than I did in 3 years of CS

Is K&R still the best to read for C? Or is there something more upto date with ANSI 11?

Is there exercises in K&R? Or is there something I can use alongside to practice it?

How? I live in Albania my CS can't be better than yours unless you live in Africa or something

course you posted is not cs, it's software engineering

looks ok, I'm not maining Java though

how did the last thread hit so many posts so fast

K&R is like a demo disk of what C can do.
Definitely not for beginners unless you are into sadomasochism.
Start with Noel Kalicharan C for beginners and Kochan C programing.

yeah we did into to oop with java and this one is called "Advanced Java"

People get rubbed the wrong way if someone insults C.

>rubbed the wrong way
sexually assaulted?

Could anyone direct me towards resources for "project structuring" in C? I'm not really sure what keywords I should be searching for but I mean like how to organize large programs into files and headers and etc?

Don't overdesign your programs. Just go with whatever, and impose a structure later as it makes sense. Being overly structured just makes shit harder to change later when you likely realise you did something wrong.

>you will never rub D the wrong way

>Generics in Java
You'll learn what disappointment feels like.

why is that

so in class we've been instructed to debug c++ using gdb. Is there something else I can use that's not so old and hideous to use?

Builtin types are illegal as type parameters.

gdb is not "old". It's still an extremely useful and relevant tool.
Stop being a fag and just use it.

sourceware.org/gdb/wiki/GDB Front Ends

That's what boxed types are for.

std::cout or printf

>That's what boxed types are for.
Yeah, as I said, disappointment.

>std::cout or printf
My debugging buddy.

But I may add that using cerr or fprintf (stderr is a better habit than cout or printf.

Does anyone have the image of ideas with programming projects?

Attached: prog_chal_1_3.png (1920x1080, 307K)

Nope.

Don't bother. If you learn C++, the begining will be the same as learning C without all the bad habits you'll have to unlearn later. And then you'll learn a bunch of powerful abstractions too.
C is essentially a dying language at this point: The latest C standard, after 7 years of work, consisted entirely of:
C18 addressed defects in C11 without introducing new language features.
The __STDC_VERSION__ macro is increased to the value 201710L.
Microsoft has also announced that their compiler will be leaving its C99 support incomplete and only supporting new C features when/if the same features are added to C++.

Thanks!

So it's ok to use C++ for embedded shit now?

>That's what boxed types are for.
They are extremely slow
You put one in a loop and it goes from O(n) to O(n^2)

why the fuck is this the norm?
struct foo {
foo() : a(0)
, b(0)
, c(0)
{}

int a;
int b;
int c;
}


and not this

foo() : a(0),
b(0),
c(0)
{}


the comma makes way more sense AFTER the variable, not before it.

I forgot the assumption that there exists a decidable total order on A. In any case, think of it as a generalization of turning an unordered pair (equivalently, ) into an ordered pair (x, y). The only way to do this if the only thing you know about the elements is that they're totally ordered is to make x the minimum and y the maximum or vice versa, i.e. sorting in ascending or descending order.

So the one limitation of the type is that it doesn't tell you whether the result is ascending or descending.

If it took lists, it could be any permutation.

there's also a version 2 and a version 4, i haven't seen version 3 posted

Why not Set though

>You put one in a loop and it goes from O(n) to O(n^2)
that's not how big O works

I've never seen the former style. I always write it the second way.

Half of these a retard easy. The other half are just keywords from Wikipedia articles that some lazy asshole copied when googling for "just cs things" and not even challenges. Ugh, fail.

>the begining will be the same as learning C without all the bad habits you'll have to unlearn later
This is literally the opposite of true. You will end up so disgusted by C++'s garbage design, you'll never want to touch it.
>The latest C standard, after 7 years of work, consisted entirely of
C17 was never intended to be a "full" standard release. It's a bugfix release for C11.
C2X is what they've actually been working on, which has new features, and is likely to be C21 or C22.
They aim for a new major standard every 10 years or so.

>But I may add that using cerr or fprintf (stderr is a better habit than cout or printf.
Only matters for errors.
Doesn't matter for temporary debugging messages

It would make more sense if it was properly aligned.
foo() : a(0)
, b(0)
, c(0)

Yes.
If anything it's no longer okay to use C for embedded anymore when C++ exists.

Sounds like a good intro for beginners

>Doesn't matter for temporary debugging messages
I agree, but you can do ./prgm 2>/dev/null to quiclky test without debugging. That's why I prefer stderr for debugging.

>It's a bugfix release for C11.
>took them 6 years, and still missed the intended release date.

>I've never seen the former style. I always write it the second way.
Good to know. It must be some kind of weird practice where I work

yeah it was properly aligned in sublime i don't know what happened when i copypasted it
regardless, what's the deal with putting the comma before and not right after the variable?

lisp

Yes, this is true. I have worked on embedded platforms with C and I can tell you that it is some shit.