/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

The most powerful programming language is Lisp. If you don't know Lisp (or its variant, Scheme), you don't know what it means for a programming language to be powerful and elegant.

Old thread:

Attached: Lisp Alien.jpg (236x213, 14K)

Other urls found in this thread:

boost.org/doc/libs/1_71_0/libs/histogram/doc/html/index.html
twitter.com/NSFWRedditVideo

...

The most powerful programming language is C++23. If you don't know C++23 (or its variant, C++26), you don't know what it means for a programming language to be powerful and elegant.

Attached: 1552842231084.png (1200x1668, 1.25M)

>using a language with "C" in the name
lmao what are you doing. I even keep away from Common Lisp just to be safe.

C++17? user why are you writing C++20, you should know all of the features of C++23 by now, just install a C++26 compiler.

Attached: file.png (183x275, 65K)

#define typename(x) _Generic((x), _Bool: "_Bool", \
char: "char", \
signed char: "signed char", \
unsigned char: "unsigned char", \
short int: "short int", \
unsigned short int: "unsigned short int", \
int: "int", \
unsigned int: "unsigned int", \
long int: "long int", \
unsigned long int: "unsigned long int", \
long long int: "long long int", \
unsigned long long int: "unsigned long long int", \
float: "float", \
double: "double", \
long double: "long double", \
char *: "pointer to char", \
void *: "pointer to void", \
int *: "pointer to int", \
default: "other")
void test_typename(void) {
size_t s;
ptrdiff_t p;
intmax_t i;

int ai[3] = {0};

printf("size_t is '%s'\n", typename(s));
printf("ptrdiff_t is '%s'\n", typename(p));
printf("intmax_t is '%s'\n", typename(i));

printf("character constant is '%s'\n", typename('0'));
printf("0x7FFFFFFF is '%s'\n", typename(0x7FFFFFFF));
printf("0xFFFFFFFF is '%s'\n", typename(0xFFFFFFFF));
printf("0x7FFFFFFFU is '%s'\n", typename(0x7FFFFFFFU));
printf("array of int is '%s'\n", typename(ai));
}

printf("char is '%s'\n", typename('a'));

char is 'int'

So this is the power of C.

What version of C++ will it be when they've finally managed to include every programming concept conceivable by man into their language (naturally, in some bastardized form)?

I'll use the version after that.

Someone mentioned zig as having a good macro system in a livestream for Jai, considering zig has a released complier I'm quite willing to listen to a zig shrill as waiting for Jai is getting old.

C++auto

daily reminder that C has generics and Go does not.

Attached: 1565890232332.png (148x265, 59K)

>be boomer
>stuck with delphi and borland c++
>be happy with new, delete and goto
>c++11 is too complicated for me I stick with raw pointers

They'll have reflections in c++2b

C generics don't actually work.

Help
I'm too retarded to learn Rust

Just use a template.

Zig doesn't have a macro system at all. Instead you can use Zig at compile-time and... the outcomes are similar. An example of this is Zig's formatted output from std.debug.warn, which are compile-timed checked and which don't require you to duplicate type information in the format string.

Dumb frogposter

Go will have Generics in 2.0
They're smart enough to think before implementing a feature

#define VECTOR_HEAD(type, name) \
struct name { \
type *data; \
size_t size; \
size_t reserved; \
}; \
void name##_init(struct name *self);

#define VECTOR_IMPL(type, name) \
void name##_init(struct name *self) \
{ \
self->data = NULL; \
self->size = 0; \
self->reserved = 0; \
}

behold my C templates

C++ has the same issue because they are weakly typed.

Rust has this feature as well in their procedural "macros". Write rust source code that directly manipulates the passed in abstract syntax tree to produce rust source code.

Zig actually doesn't do this though, the AST manipulation. That's why I said it wasn't a macro facility.

Someone smart enough to explain the incompleteness theorem to a dumb highschool dropout?

Who's worse? The rust shill or andrew shilling his dead language Zig?

Actually, procedural macros manipulate the token stream, not the AST.

No, char literals are chars in C++.

If they are so smart why hasn't golang implemented any feature yet? It's +10 years old

Every known generic implementation is a complete trainwreck.
No one is usable beside C++ templates

Sorry, yeah that's right. Usually most users just import a crate to convert it into an AST form but yeah, it's a token stream to start off with.

>No one is usable beside C++ templates
HAHAHAHAHAAHAHHAAHAHAH

Standard ML type system is all anyone ever needed. Perfection achieved: all further development is in error.

Since I'm not familiar with Zig, does this correction change things? If not, them I'm really quite curious as to what Zig is doing differently.

literally why

it changes what Rust does. Zig doesn't manipulate the token stream or the raw char stream or anything else. It doesn't have a macro system.
I can't really show it off though. Since Zig doesn't even have real documentation yet, your best bet for understanding it is to watch Andrew's presentations or streams.

just read Goedel Escher Bach.

I'm very not interested in rust, I just want to know if zig does even half of what Jai promises

Could I for example have an array of (String, #Code)? And call the code if I click a button named by the string

Histogram user here.

Here is my code:

#include

int main()
{
int c, i, nwhite, nother, j;
int ndigit[10];
nwhite = nother = 0;

for (i = 0; i < 10; ++i)
ndigit[i] = 0;

while ((c = getchar()) != EOF)
if (c >= '0' && c

Just learn C++. C is deprecated.

the line between genius and insanity is very thin

boost.org/doc/libs/1_71_0/libs/histogram/doc/html/index.html

Any logic that can express the sentence "this sentence is unprovable" is incomplete.

>On OpenBSD ...
>On my Fedora ...
your source code is different on the different machines.
the difference in result is entirely due to that, the difference in your source, and is not at all due to the difference in operating system.
change "[%d]\n" to "[%d] " if you want the stars on that line. think through what you're doing.

derp

On OpenBSD 6.5, absolutely no stars are displayed. Everything else is displayed correctly. On my Fedora 30 machine, a shitload of stars are vomited into the terminal and everything else is displayed correctly. How can I get a histogram of stars of the number of digits entered into the terminal to print beside its number?

Small correction: any logic L that can express the sentence "this sentence is unprovable in L" is incomplete. The sentence may be provable in the metatheory.

Once again C++ wins.

also, you'll want to print the stars within the first for loop. that's why I suggested 'j' instead of 'i' in the first place.
think through what you're doing. You should not be surprised by how your program behaves after the compiler has a look at it.

Sepples still has many of the problems C does like forward declarations and the import system being a glorified copy paste.

is it assumed that the sentence is true?

for (i = 0; i < 10; ++i)
ndigit[i] = 0;


same as
int ndigit[10] = {0};

printf("digits:\n");

same as
puts("digits:");
and so forth

Rust's traits and generics work together much better than C++ inheritance and templates

It's assumed there is an answer. True xor false.

Paradoxes such as "this statement is false" are more super positions, then compressible statements

Either the sentence is true or the logic is inconsistent.

>project deployed to prod with no errors
>vacation starts tomorrow

Attached: chika dance 2.gif (498x463, 2.36M)

>project mysteriously bricks tomorrow when a client interacts it in a weird way

gz lad

Attached: [Coalgirls]_Yuru_Yuri_03_(1280x720_Blu-Ray_FLAC)_[B25D1CAF].mkv_snapshot_04.11_[2018.07.11_06.39.05] (1280x720, 1.33M)

I compiled with -Dthatsanopsproblem.

good post

Attached: 1541897771418.png (250x250, 92K)

what 's the project about?

>tfw stuck in boomer legacy project for a school

M o d u l e s
SOON

>no project planning
>no deployment planning
>no vacation planning

Attached: images (1).jpg (178x283, 8K)

Only retards do learn it

anyone else experiencing analysis paralysis?

I know some python scripting and stuff, but I wanted to get into big boy programming, and there's just so much shit, so many languages, so many frameworks, libraries, etc.

I don't know what the fuck to do now.

COMMIT SMALL AND OFTEN
PUSH TO MASTER
AUTODEPLOY TO PROD

Attached: file.png (284x189, 49K)

C++2X is going to invalidate having to learn any other language. The moment C++3X adds contracts there will be no reason to even know Ada/Eiffel/Parasail.

>Parasail
man i was so excited for it, too bad it has awful, bloated syntax now
Too many people design new languages in a bubble and it's annoying.

I'm pretty sure ParaSail is just a testing language for weird features before putting them into other languages.

there's nothing to indicate that, but you may be right.

I just don't get why Adacore doesn't advertise it as much. It feels like the left out child compared to SPARK and Ada.

Can't wait until Tugboat gets cache purity.

Who else here
>emacs on Windows 10
?

I was chugging along fine, albeit slowly, at my new job, but I decided the IDE cancer is too much and I want my emacs back. IS this a terrible idea or what? My lead said whatever works is copacetic.

Probably don't want any confusion about whether Parasail is its replacement or successor etc.
Or maybe they feel its not ready for mainstream use, considering it just got string interp a few months ago.

I can't wait to use std::ada

emacs is a must for Lisp so of course my bro

Is there a decent/recommended online java resource/course? Right now I'm running through learnjavaonline.org but there's been a few weird things it kind of glosses over during the early exercises (like not telling me char variables held a numerical ascii value and would act wonky when concatenated in a string which I had to lookup elsewhere) so I'm wondering if there's something better. I'll keep running through it for now though

>wanting contracts
int mul(int x, int y)
[[expects: x > 0]] // implicit default
[[expects default: y > 0]]
[[ensures audit res: res > 0]]{
return x * y;
}

All that bloat, performance loss, and implicit exceptions. Yikes.

Honestly contracts are one of the dumbest ideas ever to be almost put into C++ and I'm glad they pitched it from C++20. C++ is a performance language. Not a fucking bloated safety language.
Literally no one is asking for contracts except academic retards. There was a study that shows that the overwhelming majority of C++ users turn off exceptions because of how horrible they are on performance. You think these same people are going to want contracts on? Lmao. GCC and Clang will both come out with switches to turn them off just like exceptions because they kill performance.

>C++ having a worse version of a D feature, again
ah yes.

Why is boost C++ library such a pain on Windows? I tried one of the installers and it seems like getting it to work with Visual Studio is beyond what it should be.

Nah, you're just a dum dum, just literally drag the headers/libs into vc or alternatively vcpkg install boost and it wil just work, VS will even autolink boost libs for you based on your current project settings and includes.

if Nene uses extensively, why can't you? are you a brainlet????

Attached: DLKXmc2XcAAOwT6.jpg (1200x675, 105K)

SEPPLES is a piece of shit language.

That's programming on windows in general.

reminds me how the 'senior lead engineer' thought it was a good idea to deploy a hot'fix' on friday just before leaving on vacation without telling anyone and of course it did not fucking work on monday morning

Because I don't use sepples.

> i am dumb dumb

That's a rotate!

Attached: cirno_cpp.jpg (800x720, 125K)

Emacs is 99.9% OS neutral. I use it on BSD at work and Windows at home. I have also used it on mac and linux variously, though not to the same extent. Just dont fuck with WSL at the moment, it is being shilled and hyped but is trash compared to the old ways.

Emacs is the OS.

>5 levels of indentation
>fuckhuge unnecessary else instead of early return
what did she mean by this?

Hiw can I make a gui for libtorrent? I don't want to change anything about libtorrent, just make the gui. thanks

>BSD at work
im going to assume you mean freebsd; why are you running a server opreating system on a desktop?

Visual Basic

but I want the gui to be C++ since libtorrent is programmed in c++, should I use codeblocks or visual studio community?

I just now learned of vcpkg. Thanks user.

what IDE do programmers at eagle jampu use?

as you can, Nene (which is cute) and her colleagues (also cute) uses Visual Studio like every cute girls do (which are cute)

Yeah FreeBSD was what we used forever on everything and old habits die hard. Only like 2 out of our 20ish team cares.

OOooh Dlang rocks!

He runs Mac OS, a BSD based OS.

>C is a computer language available on the GCOS and UNIX operating systems at Murray Hill and (in preliminary form) on OS/360 at Holmdel. C lets you write your programs clearly and simply it has decent control flow facilities so your code can be read straight down the page, without labels or GOTO's; it lets you write code that is compact without being too cryptic; it encourages modularity and good program organization; and it provides good data-structuring facilities.
>Brian Kernighan
what happened bros?

how cute!