[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: 313
Thread images: 28

File: prog.jpg (105KB, 473x496px) Image search: [Google]
prog.jpg
105KB, 473x496px
What are you working on, /g/?

Previous thread: >>61042830
>>
C++ is the best language
>>
first for you can implement any function as a c macro even if it's recursive
>>
File: haskell coin count.png (13KB, 325x222px) Image search: [Google]
haskell coin count.png
13KB, 325x222px
>>
A programming language that is a type theory describing an abstract machine.
>>
>not writing C in your Haskell
main = do 
a :: Ptr CInt <- malloc (sizeOf (int)) :: IO (Ptr CInt)

if a == nullPtr
then do

putStrLn "ERROR: out of memory."
exitFailure

else do

poke a 25
printf "%d\n" ((*) a)

free a

exitSuccess



int = undefined :: CInt
malloc = mallocBytes
(*) = peek
printf str p = p >>= print


Output: 25
>>
>>61046006
C is better
>inb4 "muh inline qsort"
write your own as a macro with a pushdown automaton
>>
>>61046028
import Text.Printf (printf)

bonus: doubles as sprintf because of type class magic
>>
>>61046028
>3 times the lines of the equivivalent C
>10 times slower
>generating garbage 1gb/s
Why not just use C though?
>>
>>61046028
now write a new program that actually does something semi-significant.
>>
>>61046028
U G L Y
G
L
Y
>>
>>61046104
such as ... ?
>>
>>61046104
that language extension is not in GHC yet
>>
>>61046126
I dont know, pick a later PE problem and solve it.
>>
>>61046129

{-# LANGUAGE Useful #-}
>>
>>61045958
Read the weight of trucks on a industrial scale connected with a pc via serial connection
>>
>>61046028
>not writing C in Rust
extern crate libc;

use libc::{malloc, free, c_void};

use std::mem;

fn main() {
unsafe {
let mut a = malloc(mem::size_of::<u8>()) as *mut u8;

if a.is_null() {
panic!("Could not allocate shit");
}

*a = 25;

println!("{}", *a);

free(a as *mut c_void);
}
}
>>
reminder that all languages are interchangeable
reminder that the language wars are stupid for this reason
reminder that "idiomatic" is only two characters off from "idiotic"
>>
>>61046191
that's not c in rust, that's just c-like rust
>>
I've been trying to learn 2D OpenGL and glut is not providing enough features I need something more GUI like. I've tried experimenting with some GUI toolkits but they are way too big and require a ton of extra code just to do simple stuff and I couldn't figure out how to get glOrtho to work with them to just setup 2D drawing. Please recommend me a good GUI library.
>>
>>61046204
>I knowingly use a garbage language and don't want other people to hurt my feelings by talking about it
>>
>>61046256
SDL
>>
>>61046239
Easily. C++ adds stuff that can be better optimized than the C equivalent.
>>
>>61046270
That can just get me the window and gl context, like glut, but not GUI widgets.
>>
>>61046260
>he uses one language and doesnt choose one based on project's requirements
check this fat neckbeard out
>>
>>61046296
You can't reprogram it?
>>
>>61046149
I find PE is generally an exercise in mathematics more than programing
finding the last n digits of the sum of the first 10^y <insert arbitrary number class here> isnt very interesting to me
>>
>>61046305
If I where to program my own then why would I need SDL when I could just render with opengl directly?
>>
>>61046300
>his language isnt multi-purpose
wew lad
>>
>>61046104
>>61046149
>semi-significant
>pe problems
>>
>>61046256
If you need GUI-like features but not the whole kit and caboodle try writing the GUI-like features you need.
If you can already do arbitrary 2D drawing, it's really not much of a difficult thing to implement at all.
>>
>>61046339
Ok. Doit, initialize a context with SDL and do pure OpenGL.
>>
>>61046342
>he wews lads frequently
top zozzle fren
>>
>>61046342
>choosing a shitty "multipurpose" langauge instead of learning multiple great languages
t. professional fizzbuzzer
>>
>>61046351
Theyre the only thing i can think of that can stay in the realm of a quick /dpt/ snippet.

I wish there was a more general purpose version though.
>>
>>61046399
t. web artisan
>>
>>61046401
is >>61046014 not a practical problem?
>>
>>61046399
>shitty "multipurpose"
>implying languages in general are either shitty or not multipurpose
>implying C, a multipurpose language, must be shitty, since it isn't not multipurpose
>implying C is shitty
>being this much of a brainlet
>>
>>61046417
>implying web artisans arent the type of people who refuse to learn anything besides their shitty javascript
>>
>>61046421
sure, why not
>>
>>61046428
>>implying web artisans
>>
>>61046427
>unironically defending using C for everything
what a fucking brainlet. C is great but nobody is going to use C for fucking everything.
>>
File: 1439859880247.gif (260KB, 266x207px) Image search: [Google]
1439859880247.gif
260KB, 266x207px
>>61046446
>>>implying
>>
>>61046452
>>unironically defending using C for everything
>unironically defending believing he was saying this
what did it mean by this
>>
>>61046428
Nah theyre the type of people who incorporate coffescript and a million other toylangs to do a simple thing.
>>
File: 192.png (217KB, 600x600px) Image search: [Google]
192.png
217KB, 600x600px
>>61046467
>>>>
>>
>not using a DSL to solve the exact problem at hand
fucking codelets man
>>
>>61046470
read up the chain a little f@m
>>
File: 1358375826200.png (121KB, 250x418px) Image search: [Google]
1358375826200.png
121KB, 250x418px
>>61046489
>
>>
>>61046495
i too, use the internet to solve my problems.
>>
>>61046495
Post example DSL.
>>
File: comfy computer saturday~.jpg (21KB, 600x454px) Image search: [Google]
comfy computer saturday~.jpg
21KB, 600x454px
>C macro composition
>>
>>61046495
T. Lisplet
>>
File: 1454354953575.jpg (355KB, 1416x1550px) Image search: [Google]
1454354953575.jpg
355KB, 1416x1550px
>c macros
>>
File: 1478021251354.jpg (43KB, 1280x720px) Image search: [Google]
1478021251354.jpg
43KB, 1280x720px
>>61046668
>c macros
>c++ templates
>>
File: 14554056007722.png (7KB, 205x203px) Image search: [Google]
14554056007722.png
7KB, 205x203px
>>61046679
>"""""generics"""""
>>
>>61046668
>rust macros
>>
File: IMG_5253.jpg (26KB, 500x565px) Image search: [Google]
IMG_5253.jpg
26KB, 500x565px
I'm starting grad school in the fall researching and devloping new communications protocols at the network layer/Layer 3 and data-link layer/layer 2. I have the help write the protocols in C. I've only ever worked with Java and Python for classes in my Networking and Sys Admin undergrad. How fucked am I and is it possible to get decent enough to make a meaningful contribution when I start in late august? I really want this to work out. I have a book on explaining implementations of the TCP/IP suite in C to start out.
>>
>>61046709
get going nigger
>>
File: gpa.png (1MB, 643x407px) Image search: [Google]
gpa.png
1MB, 643x407px
I just finished working on this C exercise to compute the average GPA, given a character array of grades (A..F).

https://pastebin.com/XzqqDQab

I extended it by writing some functions to visualize the number of grades with a histogram.
>>
>>61045958

(defun test () "Hello, world.")
(test)
>>
>>61046753
*(write-line "Hello Wolrd!")
>>
>>61046722
Yeah I know faggot. Any tips/sites/books? Anything for protocol implementations in general? I try to avoid /g/ because you're all mostly cancer compared to the rest of the industry, but worth a shot.
>>
>>61045958
>>61046753

I'm learning LISP
>>
>>61046768

Doesn't work with emacs though
>>
>>61046770
I would start by possibly,maybe learning the whole language.

K&R you melon.
>>
work
>>
4357b6:    nop    WORD PTR cs:[rax+rax*1+0x0]

The fucking fuck objdump?
>>
>>61046365
>>61046373
I just found this example of someone doing this http://www.fysx.org/2014/03/26/glimgui-released/
>>
File: GLIMGUI.png (134KB, 765x3081px) Image search: [Google]
GLIMGUI.png
134KB, 765x3081px
>>61046809
>>
>>61046782
>emacs
>>
>>61046771
As much as I love Lisp, don't learn it.
Learn something that gives jobs, like Java.
If you still want Lisp, after you've got a job, learn Clojure. (has partial applications, a god send)
>>
>>61046787
Thanks senpai
>>
(defun ! (N)
(if (= N 1)
N
(* N (! (- N 1)))))
>>
>>61046801
nvm, apparently that's a multibyte nop used for padding at the end of functions. Objdump doesn't know how to decode them properly.
>>
>>61046771
You better be doing SICP
>>
>>61046830
Emacs is a great editor. You don't like it?
>>
>>61046906
Of course. Gerald Sussman is the father I always wanted.
>>
>>61046907
If you want to talk about operating systems you should go elsewhere, we're talking about text editors here.
>>
>>61046801
Stop disassembling data segments.
>>
>>61046928
>>61046901
>>
>>61046906
>SICP
>written by academics who've never done any real programs in their life
lmaoing @ ur life

Contribute to open source projects or gtfo, faggot.
>>
>>61046926
Serious question: what do you recommend? I'm still sort of a novice with programming. I picked up emacs after vim
>>
>>61046946
that isn't very /g/entlemanly of you, anon
>>
>>61046949
Emacs a shit, so unintuitive.
>>
>>61046975
>muh dpt culture
>>
>>61046946
Not him but what repos are you currently working on, lad?
>>
>>61046946
SICP is a good introduction to computer science and programming.
>>
>>61047007
I'm doing my own.
>>
>>61046627
solve(my_problem)
>>
>>61047030
what kind of project?
You dont have to post the repo, just tell me about it.
>>
>>61047055
4chan TUI client, writtein in CL
>>
>>61047079
>writtein in CL
neat, post some snippets.
>>
What editor do you use for C?
I'm trying gVim, everybody talks shit about it but it's fine.
in b4 ed(1) is the standard text editor
>>
>>61047099
I would still use VS Code, desu
It even has a vim extension.
>>
File: average lispfag.png (524KB, 776x904px) Image search: [Google]
average lispfag.png
524KB, 776x904px
>>
>>61047186
Degerate whores should be stoned.
>>
File: hevy.gif (1MB, 297x312px) Image search: [Google]
hevy.gif
1MB, 297x312px
>>61047186
what's with those fucking thumbnails
who is this guy
>>
>>61047220
He's trying to emulate modern Youtube thumbnails.
I miss old youtube
>>
Scons vs makefile?
>>
>>61047220
your average reddit lispfag
https://www.youtube.com/watch?v=BUd4hm-ehTU
>>
>>61047279
A real module system.
>>
>>61047298
>>61047186
actual psyop shit

lisp confirmed to be an insecure language pushed by (((spies))) (hope not hate, searchlight magazine, nick loweles)
>>
>can add and delete files in src at will
>dont have to mess with a makefile or auto-make file
>shit just works when i run it

I love using a modern language.
>>
>>61047301
The fuck are babbling on about nigger?
Real projects are more than few files of one language, dumb nigger.
>>
>>61047334
>his language's module system doesn't encompass more than just code in that language
>>
Recursive is repulsive
>>
rate my cosine implementation :^)

proc cosine
1 swap dup dup * dup * 24 /
swap dup dup * dup dup * * 40320 /
swap dup dup * 2 /
swap dup dup dup * * dup * 720 /
swap pop + - + +
end
>>
>>61047403
Said the code monkey.
>>
>>61047403
t. pajeet
>>
>>61046256
https://github.com/ocornut/imgui
>>
reminder this is valid ruby
god fucking dammit
>>
File: 1324690418001.jpg (35KB, 388x380px) Image search: [Google]
1324690418001.jpg
35KB, 388x380px
tfw I'm writing a set of data reduction tools using a mix of python and matlab
>>
>>61047481
>

input
clear
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]

undefined local variable or method `dammit' for main:Object
(repl):1:in `<main>'


???
>>
>>61047432
At a glance it does look interesting but also they clearly state upfront that its not intended for a general GUI its for creating debugging tools.
>>
>he doesn't run scan-build on his project before committing
>>
>>61047500
you have to actually define them first
but if you do then it's valid ruby
>inb4 anything is valid in any language if you define it there
wrong
>>
>>61047539
>he commits
>>
61047620
>this is valid in x
>its not valid
>you just have to make it valid first!

Awful, Ruby is low-hanging fruit and you still manage to fuck up shitposting it.
>>
I want to learn lisp. Is it common lisp that one should start with? Or sbcl? Or racket?
>>
>>61047639
the argument you just made is literally exactly the one i just said is wrong
(it is btw)
>>
>>61047661
Scheme
>>
>>61047661
CL is comfy.
But do SICP first.
>>
WAIT WAIT WAIT WAIT WAIT
If you malloc a adress on Windows is it guaranteed that that the adress and its spaces are zeroes?
>>
>>61047508
I doubt you'll do enterprise level stuff, and the demo pictures look promising for general stuff.
>>
>>61047691
no
>>
>>61047661
/dpt/ why are there'd not an dialecticing ofsford le SBCL que se alpaca SnowballCool?
>>
>>61047697
WHAT THE FUCK
Is it that way on linux?
>>
>>61047413
>>61047421
>>61047421
Didn't really mean it desu, it's just fun to say
>>
>>61047717
no
the function you're looking for is calloc, which does guarantee zero on all platforms
>>
>>61047717
No it just gives you raw memory space. Calloc is your friend, my dude
>>
void enqueue(queue *q, int x) {
qnode *temp = malloc(sizeof(qnode));
temp->data = x;
temp->next = nil;
if(!q->head && !q->tail) {
temp->prev = nil;
q->head = temp;
q->tail = temp;
return;
}
temp->prev = q->tail;
q->tail->next = temp;
q->tail = temp;
}

int dequeue(queue *q) {
int val = q->head->data;
qnode *temp = q->head;
if (q->head->next) {
q->head->next->prev = nil;
q->head = q->head->next;
} else {
q->head = nil;
q->tail = nil;
}
free(temp);
return val;
}


Rate my queue implementation, senpai.
>>
>>61047734
>>61047740
We werent even taught that yet lmao
I'm just going to write a function that makes all zeroes since I'm not supposed to know calloc yet
>>
>>61047752
Disgusting, start again with a resizable ring buffer this time.
>>
>>61047752
>void enqueue
>void
kek.
>>
>>61047757
Do profs unironically look down on students self-learning and getting """ahead""" of the lesson?
>>
>>61047763
Circular buffers are preferred when maximum size is known. And resize is just a realloc.
>>61047792
It never fails, so.
>>
How can I increment all the elements in a 2D array starting in a given position by one position?

In C.
>>
>>61047794
Pretty sure no one gives a shit
But if a corrector needs to not always give full points so that he isnt noticed he might just deduct me points
>>
File: kali.png (499KB, 1366x768px) Image search: [Google]
kali.png
499KB, 1366x768px
Due to my OS anything i say MUST be true when related to security

C is the safest language on earth, PHP a close second
>>
>>61047757
Are you also not supposed to use Google?
>>
>>61047757
You could use memset, but if you don't know calloc, you probs don't know that either.
Also of the teacher doesn't accept feautres not yet taught, then he is a dumbass desu
>>
>>61047794
At my uni, it depends on the prof
>>
>>61047819
Question makes no sense.
>>
>>61047827
>>61047822
Actually just reread the excercise
It says that you should use malloc
>>
>>61047827
He probably doesn't accept features not yet taught because morons like you keep doing retards homework for them.
>>
>>61047848
Hes asking given
[1,2,3]
He wants to do
arr[1++]
And get
[1,3,4]
>>
>>61047821
Nice paint skills zex @ pngsec you fucking faggot
>>
>>61047821
> security artisan cant even crop his name out
wew
>>
>>61047814
>It never fails, so.
>malloc
>get a pointer as argument
>never fails
kek. k tard. guys like you are the reasons why C shall be avoided at any cost.
>>
>>61047882
>2d array
>>
>>61047882
I think he meant
[1, 3, 4, 6, 7, 8] --> [1, 0, 3, 4, 6, 7]

But in a matrix.
>>
File: thatsthejoke.jpg (31KB, 600x450px) Image search: [Google]
thatsthejoke.jpg
31KB, 600x450px
>>61047891
>>61047901
>>
>>61047863
Just malloc?
How about memset() then?
>>
>>61047891
>>61047901
>Not fucking getting the joke
>>
>>61047937
Nah
I think they might have expected solutions that dont need the memory to be zero
But considering it has got to do with strings...
>>
>>61047966
>>61047932
its a reddit-tier ""joke""
>>
File: 1447379211629.jpg (32KB, 572x303px) Image search: [Google]
1447379211629.jpg
32KB, 572x303px
I kind of want to get into Elixir. Is it a meme? Should I just focus on Erlang instead?
>>
>>61047915
>get a pointer as argument
Queue is on the stack, so no problem.
>malloc
qnode is too little to care.
>>
>>61047932
>>61047966
let me know how many reddit points this gets, its a really funny joke afterall
>>
>>61047848
>>61047882
I already solved it. >>61047921 was right.
>>
>>61047973
>Doesn't get the joke
>mad that fellow autists laugh at said ignorance
>i-i-ti's a r-reddit-tier j-joke f-faggot
>>
File: 1374875760683.gif (911KB, 171x141px) Image search: [Google]
1374875760683.gif
911KB, 171x141px
>>61047998
keep them awsum jokes comin, man
>>
>>61047976
elm desu
>>
>>61045958
Why would anyone use C++ over D?
>>
>>61048350
They shouldn't. But there are people that use Node.js too
>>
>>61048350
>>61048382
15 Romanian Lei has been deposited on your account.
>>
>>61048382

Node.js is great for writing 20 line servers.
>>
>>61048397
12 rupees and a plate of curry has been deposited to your microsoft visual C++ account rakesh
>>
>>61048409
Did you just assume my language?
>>
>>61048397
>tfw andrei has a qt gypsy girl protege doing work on d's templates
>>
>>61045958
metaprogramming C
>>
>>61048441
oxymoron
>>
>>61048350

They like to be able to use the language without the GC and without reimplementing all the libraries themselves.
>>
>>61048481
I wish more people would actually read up on D's GC without spouting the same shit and assuming its just like java's.
>>
>>61048481
That's why C exists. Why would you use standard library in your micro kernel in the first place?
>>
>>61048515
C is 2 times slower than C++ on a typical task like sorting an array tho.
>>61048506
I watched a presentation from BoostCon recently, it's still shit, with @nogc you basically leak memory until you call the gc manually. Even C++14 with *_ptr is better.
>>
>>61048546
@nogc isnt even the extent.
https://dlang.org/phobos/core_memory.html
>>
>>61048546
>with @nogc you basically leak memory
So basically like any non gc language?
>>
>>61048564
Not if you can actually program.
>>
>>61048564
>he can't into raii
>>
>>61048564
Not like any language with RAII. And it's even worse than C because it needs to scan all the stuff and run a full-blown GC from time to time. malloc and free are basically instantaneous in C.
>>
>>61048546
>*_ptr
Wat?
>>
>>61048546
>C is 2 times slower than C++ on a typical task like sorting an array tho.
lolno
>>
>>61048583
Exactly
>>61048584
>>61048594
D has RAII already
>>
>>61048595
>he doesn't know modern C++
http://en.cppreference.com/w/cpp/memory
>>
>>61048601

did you just miss the whole previous thread
>>
why is garbage collection so slow?
>>
>>61048611
GC isn't slow
>>
>>61048602
>D has RAII already
too bad every single library you'll ever come across doesn't
>>
>>61048606
Some people have a life and aren't on /g/ 24/7.
>>
File: 1498222300263.png (39KB, 793x831px) Image search: [Google]
1498222300263.png
39KB, 793x831px
>>61048601
Not this shit again, plz.
>>
>>61048611
Fuck ton better than shitty ref counting
>>
>>61048621
sorry
>>
>>61048594
>and run a full-blown GC from time to time.
GC.disable;
//performance intensive things
GC.enable;
>>
>>61048624
RAII is literally built in
>>
>>61048605
Oh you meant * in the text matching sense. I got confused.
>>
>>61048638
Based.
>>
>>61048629
I thought we weren't using the standard library
>>
>>61048611

Because cleaning up after yourself is ultimately faster than leaving your mess about and waiting for somebody else to deal with it.
>>
>>61048638
in Haskell you can call the GC to do a cleanup, which effectively gives you some control on when it runs
>>
>>61048611
GC can achieve comparable performance only by consuming 5x times more memory.
>>61048632
How do you think D's GC is implemented? It's even worse, it scans the heap looking for something like a pointer.
>>61048638
So you just confirm that I said, you need to call GC from time to time overwise you're leaking stuff. Good luck calling it on a real-time network service.
>>
>>61048687
You can even do this in Lisp. It's really not that special.
>>
>>61048691

memory capacity is cheap these days, usage is much more important
>>
>>61048691
>you're leaking stuff
>>61048583
>>
>>61048691
>you need to call GC from time to time overwise you're leaking stuff.
Not necessarily.
/g/ refuses to accept that D can be just as RAII as sepples And the GC is on its way out anyway with all the recent DIPs getting through.
>>
>>61048712
> the GC is on its way out anyway
Are they about to write a C compiler able to inline qsort as well?
>>
>>61048691
You are not making sense, even if D's GC is not smart you can manually turn them off, call C libraries and turn them back on again during idle period. It's not a rocket science, it's the ultimate ease of use
>>
>>61048687

wow, so I can *choose* when my program stalls.... amazing
>>
>>61048731
>network service
>idle period
Rrright.
>>
>>61048701
yes, that's why I was saying to >>61048638
>>
File: 10_lei._Romania,_2008_a.jpg (140KB, 800x428px) Image search: [Google]
10_lei._Romania,_2008_a.jpg
140KB, 800x428px
Please don't post this fast I'm having trouble depositing all the bonuses.
>>
>>61048712
Not only that, I wouldn't be using C++ in any way because it's a shitty language. Even Rust is better than that crap.

>>61048756
If it the module is a network service don't use GC then?
>>
I'm making a program that's pretty similar to paint. some basic drawing capabilities. I only now noticed that if I move the mouse too fast there is tearing between "pixels" that get marked with the mouse, while the pencil in regular MS paint doesn't tear, it's a continuous line. Enyone have any guess how that's implemented so that it can trace the whole movement, not just when the refresh rate catches the momentary position of he mouse?

Generally, can anyone recommend a good read on basic drawing stuff, like, which pixels to choose to best approximate circles, lines, curves, and how to do it when the "brush" is different width and so on.
>>
>>61048765
I wasnt trying to say its impressive, just that the GC isnt oppressing you. You can tell it to fuck off anytime and use your mallocs.
D even has gc-less arrays.
>>
>>61048350
At least C++ will get me a job.
>>
File: Sponsored by Micorosft.jpg (255KB, 1365x902px) Image search: [Google]
Sponsored by Micorosft.jpg
255KB, 1365x902px
Just keep trying, vishnu
>>
>>61048795
So will Node.JS
>>
>>61048792
>D even has gc-less arrays.
Is that supposed to be impressive?
I don't have a dog in this fight but if this is supposed to be reassuring then it sounds like D really is useless without GC.
>>
Thank you for all your support, >>61048797
>>
>>61048803
Again, no, just a feature.

Give me a thing and iw sure i could do it without invoking the gc.
>>
What are languages with C ABI?
none of that shitty extern "C".
>>
Excerpt from a heterogenous container I've been working on :)

template<typename U, typename Fcns>
void perform(const U& u, const Fcns& fcns) {
std::for_each(v.begin(), v.end(), [this, &u, &fcns](const T& t) { hetvec<Ts...>::f(t, u, fcns); } );
hetvec<Ts...>::perform(u, fcns);
}
>>
>>61048867
>std::for_each
sad
>>
>>61048842
Every language worth giving a shit about has interoperability with C.
But C and assembly are the only languages that truly have the C ABI. There might be some other older languages which do as well, but I'm not really sure.
>>
>>61048867
C++ was a fucking mistake.
>>
>>61048867
Where does Ts come from?
>>
>>61048842
void main()
{
import core.stdc.stdio : printf,scanf;
import core.stdc.stdlib: malloc, free,exit,rand;

int i,n;
char * buffer;

printf ("How long do you want the string? ");
scanf ("%d", &i);

buffer = cast (char*) malloc (i+1); //note: cast is
required without extern
if (buffer==null) exit (1); // note: NULL is null
in D without extern

for (n=0; n<i; n++)
{
buffer[n]=rand()%26+'a';
buffer[i]='\0';
}
printf ("Random string: %s\n",buffer);
free (buffer);
}
>>
>>61049036
A language calling C functions is one of the least impressive features you could have.
Go kill yourself, you Romanian shill.
>>
61049061
>asks for a language with abi
>post example
>youre a shill

Alright m8
>>
>>61049061
>A language calling C functions
So pretty much many languages?
>>
>>61049079
He gets paid by Microsoft to shill C++, he's been doing it for the last two weeks
>>
>>61049036
Can I call D functions from C?
>>
>>61049107
Yes, you can even call D from C++
>>
>>61045958
What jobs use D?
>>
>>61049090
Exactly. That's why it's so unimpressive.
>>
Scheme is the most powerful language

Python, Ruby, Lua are all like little babies compared to it

CL is an mutated abomination best kept locked in the basement, the family's shameful secret
>>
>>61049145
D is more impressive than C++
>>
Boost is the JQuery of C++
>>
>>61049149
If scheme is so powerful, why does nobody use it
>>
>>61049149
Erlang is faster + more features
>>
>>61049141
Literally nobody uses D, except for Andei's shills on here.

>>61049160
That's not saying much. C++ is a fucking travesty.
>>
>>61049141
Facebook, ebay etc
>>
Best machine learning books?
>>
>>61049174
Rust doesn't have a memory model
>>
>>61049141
To add onto this, what languages should I learn if I want a job
>>
>>61049186
Who the hell mentioned Rust?
>>
>>61049196
You, a few posts back
>>
>>61049162
Most people can't use it

It is our industry's shameful secret that most of our people cannot even do the basics

>>61049164
Erlang isn't even worth mentioning, shitposter
>>
>>61048786
dunno sorry
>>
>>61049202
No I didn't.
>>
>>61049208
so it's useless then got it
>>
>>61049141
https://dlang.org/orgs-using-d.html
>>
>>61049174
That poster was wrong. D is less impressive than C++. C++ is a mature, production-ready language, with wide support. D is not.
>>
>>61049218
If just one person uses it, it is not useless.
>>
>>61049229
I think the fact D is this old and has gained so little traction is even more impressive.
>>
File: 1498117439711.png (753KB, 1338x5868px) Image search: [Google]
1498117439711.png
753KB, 1338x5868px
>>61049229
>C++ is mature
If by mature you mean smuggling 30 functions from boost into the standard library for "fixing things" for the past 45 years, yes.
>>
>>61049250
name one significant project made in scheme
>>
>>61049264
>45 years
What timeline are you on?
>>
>>61049229
C++ isn't production ready. This is why companies use a different std lib
>>
>>61049229
C++ is unreadable pile of garbage
>>
>tfw your language only has one std
I wish i was as big and strong as sepples-dono!
>>
>>61049289
Unparseable too
>>
>>61049298
2*
>>
>>61049267
gdb
>>
>>61049186
Would you mind explaining what you *actually* mean by this? Do you mean that there isn't a standards document specifying how objects are stored in a Rust program? That's a valid criticism I suppose, however as far as I know the official Rust compiler is still evolving, which means there isn't really any point in defining a ``standard" of the language at this point since it would only limit future changes. That isn't going to happen until they reach the first ``final draft" of the language. But just because you can't look it up doesn't mean it doesn't exist. The current compiler (which does define the current semantics of the language, for all intents and purposes) does implement a memory model insofar as having clearly defined semantics about how objects are stored. It has to, without it practical code generation would be impossible.
>>
>>61049298
>C++
>One std lib
ha ha ha
>>
>>61049328
>>61049309
jeez lads, howd you misinterpret that one.
>>
>his language doesn't require tail call optimization
literally inelegant
>>
>>61049312
written in c
>>
>>61049298
>C++ has one std
lol nice one
>>
>>61049312
GDB is written in C!
>>
>>61049343
>He can't manually optimize tail calls
literally inelegant
>>
C and shell are the only two languages worth using
>>
>>61049326
>l they reach the first ``final draft" of the language.
I'm intrigued. I thought Rust reached v1.0 already
>>
File: 1473616416748 (1).jpg (688KB, 1181x1748px) Image search: [Google]
1473616416748 (1).jpg
688KB, 1181x1748px
>>61049366
h-haskell?
>>
why should i learn python over golang
>>
>>61049360
>companies hire people who will spend time manually optimizing tail calls
literally wasteful
>>
>>61049366
>>
>>61049381
s-SLOW!
>>
>>61049389
meant for >>61049229
>>
>>61049391
don't you mean
sssssssssssslllllllllllllllllllooooooooooooowwww(...) is not responding
>>
>>61049385
python doesn't have a type system that gives you nothing in exchange for straitjacketing you
>>
>>61049366
People that only know one or two languages are mosty bad programmers.
>>
>>61049403
s-
KERNEL_PANIC_OUT_OF_MEMORY ERROR
>>
regarding 61049366
have you ever programmed anything in them though?
>>
Why is seemingly half of the Scala community expending a huge amount of effort making a new functional programming library when a superior one already exists that they could contribute to?

I mean just look at the kinds of issues they're quibbling over in https://github.com/typelevel/cats/issues
>>
>>61049385
employment
>>
>>61049444
>Cats is a library which provides abstractions for functional programming in Scala.
n-nani?!
>>
Completely agree, I know:

>JavaScript
>ES7
>Angular
>Node
>HTML5
>CSS
>jQuery

If I had limited myself to only one or two of those languages, I'd be unemployable.
>>
>>61049468
Wrong thread
>>>/g/wdg
I don't want your reddit stink nearby
>>
>>61049463
It's like a perpetually in-beta half-implementation of Scalaz, because no Australians allowed or something
>>
>>61049444
>>61049518
fucked that one up
Why is the Scala community expending a huge amount of effort contributing to a bad functional programming language when several superior ones already exist that they could contribute to?
>>
>>61049511
But i thought Scala technically was a functional language.
How lacking is the std, exactly?
>>
>>61049493
Let me guess, you think I belong in /wdg/? In case you didn't know, Node.js is ideally suited to backend work. Don't be jealous that it integrates more easily with frontend code than your favorite language does.
>>
>>61049528
Because it runs on the JVM and many clients are weirdos who insist that their stuff has to run on the JVM because apparently that's enterprise production-ready or some other bullshit
>>
Languages need to stop having JVM support so Java java can finally die tbqh
>>
>>61049611
we need a C compiler for the JVM
>>
>>61049611
provide an alternative to jvm
>>
>>61049530
https://www.youtube.com/watch?v=4jh94gowim0
>>
>>61049623
I believe there is some fundamental JVM design decision which means that C cannot be compiled for it.
I'm pretty sure it has to do with memory allocation or some shit.
>>
>>61049624
microsoft jvm
>>
>>61049530
>>61049628
Also https://www.youtube.com/watch?v=TS1lpKBMkgg
>>
>>61049646
well a "~C" compiler
>>
>>61049628
> i dont know how much longer i can write scala without jumping off of something

this is gonna be a good presentation.
>>
>>61049662
That would be useless. There would be no way to leverage the swaths of existing C code.
>>
>>61049677
Well primarily it depends on the difference
>>
File: 1495587353928.jpg (9KB, 184x184px) Image search: [Google]
1495587353928.jpg
9KB, 184x184px
who /embedded/ here?
>>
>>61049709
Looks like you aren't portable
>>
hi

NEW THREAD NOW

>>61049799
>>61049799
>>
>>61049709
Is this as mundane as it sounds?
>>
>>61049709

me too
>>
>>61049646
not true
https://github.com/davidar/lljvm
Thread posts: 313
Thread images: 28


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