[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: 340
Thread images: 20

File: 1477536114603.png (1MB, 1000x1400px) Image search: [Google]
1477536114603.png
1MB, 1000x1400px
Old thread: >>59070063

What are you working on, /g/?
>>
>>59074951
First for D
>>
>>59074951
>literal fag shit
Delete this thread and kill yourself.
>>
>>59074974
there is NOTHING gay about a cute trap
>>
>2017
>Falling for the C meme
>>
anyone know a good book for someone who wants to learn C++ but already knows Java (and a few other languages). Looking at "accelerated C++" and "C++ Primer", can't decide between the two.
>>
>>59075000
Not learning C++ is the best option.
>>
>>59074951
Thank you for using an anime image.

>>59074995
>year of the lord MMXVII
>not pooing in loo
>>
In the mood for a programming talk, any recommendations?
>>
>>59075014
This. Learn Python instead
>>
>>59074951
Is it autistic to zero out structs full of pointers using memset?
>>
>>59075058
How else would you do it?
>>
>>59074736
Probably has something to do with your nullptr clause. Why are you newing 2 extra nodes?

Can you post your class definitions file? I don't want to sound like a faggot but I think you could streamline this quite a bit.
>>
Hello friends. I am trying to implement a Linked List in C++ by myself. Valgrind is saying that there is a memory leak within the append method. I tried to figure out what it was but I couldn't find it. Any tips?

void LinkedList::append(std::string name, std::string occupation){
Node* addNode;
if(this->headptr == nullptr){
addNode = new Node(this->headptr,this->tailptr,name,occupation);
this->headptr = new Node(nullptr,addNode);
this->tailptr = new Node(addNode,nullptr);
}
else{
addNode = new Node(this->tailptr->prev,this->tailptr,name,occupation);
this->tailptr->prev->next = addNode;
this->tailptr->prev = addNode;
}
}
>>
>>59075047
https://www.youtube.com/watch?v=KMU0tzLwhbE
>>
>>59075058
>>59075064
Why, though?
struct mystuct s = {0};
>>
>>59075065
I posted here again right before you responded in the other thread. I'll post it.

#ifndef LINKED_LIST_H
#define LINKED_LIST_H
#include <string>
#include <iostream>

class Node {
friend class LinkedList;
private:
std::string name = "";
std::string occupation="";
Node * prev = nullptr;
Node * next = nullptr;

public:
Node(Node* prev, Node* next, std::string name, std::string occupation);
Node(Node* prev, Node* next);
~Node() = default;
}; // Node

class LinkedList {
private:
Node* headptr = nullptr;
Node* tailptr = nullptr;
public:
~LinkedList() = default;
void append(std::string name, std::string occupation);
int deleteItem();
int deleteItem(int position);
//int deleteItem(std::string occupation);
int deleteItem(std::string name);
int length();
void printList();
};
#endif /** LINKED_LIST_H */

>>
>>59075076
Thanks
>>
>>59075078
Doesn't work if it's dynamically allocated.
>>
>>59075066
if(this->headptr == nullptr){
addNode = new Node(this->headptr,

hmmmmm
>>
>>59075107
*ptr = (struct mystuct){0};

or just use calloc.
>>
>>59075109
maybe I am misunderstanding the head and tail of a linked list. I am treating it as a starting point where it doesn't hold any real data. That is why I check if the headptr itself is null so I know if it has anything.

I then create a node that has the new data but I can't really delete it afterwards. What would be a better approach?
>>
>>59075115
I don't think calloc is guaranteed to work if the struct contains pointers; the whole 0 == NULL convention only exists at compile time, not at runtime.
>>
>>59075131
memset won't work with that, either.
>>
>>59075126
head and tail point to the first and last nodes, respectively. If there aren't any nodes, they don't point to anything.

>>59075089
It would simplify things greatly if Node was a struct instead of a class.

Just think it through and be systematic. When you append to (the back) of a double linked list:

1) create a node from given data. Don't worry about its pointers yet.

2) if this is the first node, set the head and tail to this node. The node's pointers will remain nullptrs.

3) otherwise:
set the old tail node's next ptr to the new node
set the new node's prev ptr to the current tail node
set the new tail to the newly created node

you're doing a lot in the constructors. It'd be easier and more readable to handle the pointers separately.
>>
Working on a list of things my dream language would have. Whether I actually implement it or not is another question

1. 'use' for importing
2. # for local imports
3. RefCounting
4. Structs only, no classes
5. Absolutely no ::
6. Extra constraints on a function must be specified in a declaration file (or in some other clean way, idk)
7. D-tier metaprogramming
8. Static, strong (?) typing
9. Compiled
10. Use Posix library as the standard library
>>
>>59075188
>>59075066
Here's an example of what it could look like. Now I don't want to suck my own dick or confuse you, but this should show you the flow of what you need to do:

template<typename T>
void DLinkedList<T>::insertBack(T data) {

//create node object with our data
dlNode<T> *item = new dlNode<T>(nullptr, nullptr, data);

//if this is first element, set head accordingly
if(elemCount == 0) {
head = item;
}

//else, we already have a head and tail pointing to something
else {
tail->next = item;
item->prev = tail;
}

tail = item;
++elemCount;

}
>>
>>59075008
If I wanted to print the toString method, what would need to be modified?
>>
>>59075200
You've literally described C you tit
>>
>>59075223
in Java, toString() is a common method that returns a string. Generally, you don't want the method itself to print anything.

So to print it, you would just call
Minesweeper m;
...
System.out.print(m);

Or something similar.
>>
>>59075000

I enjoyed what I read of C++ Primer (coming from Python and a little bit of C).

Haven't ever read the first one.
>>
>>59075235
Did you even read the list
>>
>>59075316
Aside from 'use', that's C.

#include, no classes only structs, no ::, constraints on functions are specified in the header file, static and strongly typed, compiled, uses Posix
>>
>>59075222
Thanks mate. I'll just scrape the whole second class thing and just turn it into a struct.
>>
>>59075235
haha
>>
Ban C
>>
Trying to learn Python here.
What is the difference between List and Generator. I am trying to understand when it the proper time to use Generator and Yield over a list. If I only want to iterate over a loop once in my entire program I use a generator but if I want to use the same loop multiple times I use list?

Is that right?
>>
>IMPERATIVE
>LINK
>LISTS
fucking get out
get the fuck out
we don't need you and your shit

>>59075200
t. doesn't know anything about language design, thinks picking and choosing arbitrary features from his favorite meme lang would somehow make a "good" language
>>
>>59075538
>we don't need you and your shit
Don't call us, we'll call you
>>
>>59075538
Computers are imperative, you dork.
>>
>>59075555
Even in an imperative language, persistent immutable linked lists are the only good kind of linked list. If you want a mutable container, use a vector.
>>
File: 1405827694276.png (769KB, 1200x860px) Image search: [Google]
1405827694276.png
769KB, 1200x860px
>>59075538
>thinks picking and choosing arbitrary features from his favorite meme lang would somehow make a "good" language
Look at ruby, u dumbfuck.
>>
>>59075572
someone slept through complexity class

Say I want to parse through data and sort it while I parse it. Do I still use a vector?
>>
I'm trying to make minesweeper in java but I hit a wall trying to do two things.

I have two arrays called mn[row][column] (boolean) & minedneighbours(int) which represents the minefield & the number of neighbouring squares which contains mines for each squares.

I want to ask how to:
A) create a method with row & column param, which set the tile that will be mined & then increments the neighbouring total of the surrounding tiles using a for loop.
It should return true if the mile is mined & false if the max num of mines is exceeded or the square is already mined.

Anyone know how to do this, as the instructions are really vague?
>>
>>59075412
>#include
No, # does something different
#use lib; // lib is imported only for fun(), may change it and just do it in the function definition
void fun();

>constraints on functions are specified in the header file
I'm more thinking of typeclasses like Haskell has when I say this, C afaik has nothing like that
>strongly typed
C's weakly typed

Also I'm not actually gonna use the Posix library, that was a bad joke

>>59075538
>arbitrary
I mean, I kind of chose them for a reason
>>
gcc: warning: main.o: linker input file unused because linking was not done
gcc: warning: history.o: linker input file unused because linking was not done


Can somebody shed some light on wtf is happening? I have an identically configured Makefile for another project with the exact same flags and it works perfectly, but when trying to add in another file to this project it just starts spitting this error and doesnt produce the executable.

CC = gcc
CFLAGS = -Wall -g -c

all : main

main : main.o history.o
$(CC) $(CFLAGS) $^ -o output

main.o : main.c history.h
$(CC) $(CFLAGS) $<

history.o : history.c history.h
$(CC) $(CFLAGS) $<
>>
why do you guys hate Java so much? What has Java ever done to you?
>>
>>59075685
seems like linking wasn't done
>>
File: 1479425846260.jpg (27KB, 450x375px) Image search: [Google]
1479425846260.jpg
27KB, 450x375px
>>59075709
You know damn well what I'm trying to get help with
>>
>>59075685
-c on final link
>>
>>59075713
https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html
>-c
>-S
>-E
>If any of these options is used, then the linker is not run
>>
>>59075624
minedneighbors should not be an array
public boolean minePosition(int r, int c) {
if(pos[r][c].isMined() || mineCount == maxMines) return false;

else {
pos[r][c].setMined(true);
}
return true;
}


you should only start counting mined neighbors after you're done placing all the mines. Unless you plan on adding mines while in game.

public void updateNum(int r, int c) {

pos[r][c].minedNeighbors = 0;

//count left neighbors
for(int i = -1; i < 2; ++i) {
if( r-1 is in bound ) {
if( (c + i) is in bound ) {
if(pos[r-1][c+i].isMined()) ++minedNeighbors;
}
}
}

}


blah blah blah. you get the point.
>>
Good place to start with C? I'm working through "Learn C the hard way", what would be a good beginner/intermediate to move on to?
>>
>>59075784
try 'pointers on c' kenneth reek
>>
>>59075784
>Learn C the hard way
That book is absolute garbage, and the author is a hack.
>>
>>59075798
What would you suggest?
>>
>>59075572
Literally the only advantage of linked lists over arrays is that you can easily add and remove nodes from any position. An immutable linked list is like a car without wheels.
>>
>>59074951
How good is that book my teacher recomended this meme book to the class
>>
>>59075809
C++
>>
>>59075828
k&r is useless trash for 2017, unless you're a historian
>>
>>59075828
good book, don't listen to >>59075840
>>
>>59075830
Why c++ over C? I've heard a few people say programming didn't truly sink in for them till they tried C, but why C++?
>>
>>59075862
Cause it is nice to have a skill that could one day get you a job. Don't listen to the C-tards
>>
>>59075862
C++ is more relevant, as close to hardware as C (as far as memory allocation/pointers go), and teaches principles that will help you in pretty much all other relevant programming languages (OOP).

It's just better.
>>
>>59075844
listen to this diehard, read k&r and you will pickup shitty habits and style from 70s that you will end up re-learning later.

or you could begin with >>59075796 (which also covers all the k&r shittyness) and avoid wasting time altogether.

if your teacher advised you k&r, he is either stupid or trolling.
>>
>>59075924
Or he is old school and caught in his old ways. You will be surprised how many people are like that in the working world. Project leads and directors that refuses to budget because "That's the way it has always been done". This doesn't just apply to coding.
>>
>>59075873
>>59075917
Alright, do you guys have any books for c++ then? I know I can find them, but I'd love a recommendation.

What about C#?
>>
>>59075862
the language wars are so unbelievably insignificant to what beginners will do that none of the reasons why you should pick one over the other will change the outcome of your education so long as your teaching material is good, and you can write off idiots peddling their language to you as a beginner

no matter which language you learn it will open a gateway into easily learning the others, and you will definitely be using more than one language EVENTUALLY in your journey as a programmer, but that will happen when you're more knowledgeable about why certain languages may be better in some situations than others
if you want to know how computers work, (you will have to accrue this knowledge eventually, one way or another, to not be a shit programmer) then starting with C is a good option
>>
>>59075964
(((C#))) is by the jews. And I mean it seriously because fuck MS.

As for the books, try
http://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list
>>
>>59074951
Eval and apply and read-eval-print loops
Conses and cdrs and closures and stack groups
Sussman and Abelson and their teachings
These are a few of my favourite things

Structures and data and big O notation
Factorisation and search and collation
Linked lists and quivers and matching on strings
These are a few of my favourite things

Functions and sets that can both be a number
Hotels where infinite lodgers may slumber
Monoids and functors and vectors and rings
These are a few of my favourite things

When the core dumps
When the bugs show
When I'm feeling sad
I simply remember my favourite things
And then I don't feel so bad
>>
>>59075628
Why not just using inside of the function?
void fun()
{
using lib;
// whatever
}
>>
>>59075862
c is pretty small, you have to implement a lot of stuff yourself, means you have to actually know algorithms,hardware,os,networking,etc. so if you suck at any of it, you code in c will suck, that's why people, who can't or don't have time to implement in c, go into c++ where a lot is already implemented but with the cost of bloatedness.
>>
>>59074951
I'm interested in learning programming, what should I start with?
>>
>>59076101
Lisp.
>>
>>59076101
Do you have prior knowledge with programming?
I suggest Python if you don't. Ignore people who say C or C++. Only do does if you are very sure you will like programming and in it for the long run. Python will give you a bare minimal taste of what programming is like. Decide afterwards if you want to commit to programming and then come here and ask again.
>>
>>59076101
knee socks
>>
>>59076101
Haskell
>>
File: Socks.png (180KB, 316x464px) Image search: [Google]
Socks.png
180KB, 316x464px
>>59076255
Knee socks?
>>
Great, C has given us yet another privilege exploit in the Linux kernel.
>>
File: test (2).png (716KB, 811x599px) Image search: [Google]
test (2).png
716KB, 811x599px
How do I into lambda calculus?
I have formal language background.
>>
Okay.
Sell me on Rust
>>
>>59076594
It's shit.
Don't bother.
>>
>>59076606
What are you defending?
>>
>>59076594
Don't bother. It is free. Just leave some ferrous object out in the open.
>>
>>59076613
The integrity of iron.
>>
>>59076594
Rust is not a revolutionary language with new cutting-edge features, but it
incorporates a lot of proven techniques from older languages while massively improving upon the design of C++ in matters of safe programming. The Rust developers designed Rust to be a general-purpose and multi-paradigm language. Like C++, it is an imperative, structured, and object-oriented language.

Besides this, it inherits a lot from functional languages and also incorporates advanced techniques for concurrent programming.
In Rust, the typing of variables is static (because Rust is compiled) and strong. However, unlike Java or C++, the developer is not forced to indicate the types for everything as the Rust compiler is able to infer the types in many cases. C and C++ are known to be haunted by a series of problems that often lead to program crashes or memory leaks which are notoriously difficult to debug and solve.
Think about dangling pointers, buffer overflows, null pointers, segmentation faults, data races, and so on. The Rust compiler (called rustc ) is very intelligent and can detect at least 99% of all these problems while compiling your code, thereby guaranteeing memory
safety during execution. This is done by the compiler by retaining complete control over memory layout, without needing the runtime burden of garbage collection. In addition, its safety also implies much
less possibilities for security breaches.

/g/ toddlers do not like it because they are. beginners, Rust is a bit too hard for them to swallow. So they are butthurt over it. Most of the Rust haters are pre teen undergrads that know zero thing about programming and what a piece of shit C really is.
>>
>>59076661
>pre teen undergrads
If you are a pre teen and an undergrad, that would make you a genius. I think you mean, pre teens or undergrads.
>>
>>59076661
>>59076594
Also Rust compiles native code like Go and Julia. However, in contrast to these two, Rust doesn't need runtime with garbage collection. In this respect, it also differs from Java JVM and the languages that run on the JVM, such as Scala and Clojure. Most other popular modern languages such as .NET with C# and F#, JavaScript, Python, Ruby, Dart, and so on, all need a virtual machine and garbage collection.
As one of its mechanisms for concurrency, Rust adopts the well-known actor model from Erlang. Lightweight processes called threads perform work in parallel. They do not share heap memory but communicate data through channels, and data races are eliminated by the type system. These primitives make it easy for programmers to leverage the power of many CPU cores
that are available on current and future computing platforms.

I hear /g/ babbies moan about rust being not portable, which is very laughable. The rustc compiler is completely self hosted, which means that it is written in
Rust and can compile itself by using a previous version. It uses the LLVM compiler framework as its backend and produces natively executable code
that runs blazingly fast because it compiles to the same low-level code as C++.
Rust is designed to be as portable as C++ and run on widely used hardware and
software platforms; at present, it runs on Linux, Mac OS X, Windows, FreeBSD,
Android, and iOS. It can call C's code as simply and efficiently as C can call its owncode, and conversely, C can also call Rust code. Rust can even "pretend" to be C and produce the same piece of shit unsafe binaries but that'd defeat the purpose of such a great language.
>>
>>59076661
Does it mean Rust is purely functional? No love for OOP?
>>
>>59076717
>>59076661
What high paying job can I get if I know Rust.
>>
>>59076717
> Rust adopts the well-known actor model from Erlang.
No it doesn't.
> Lightweight processes called threads perform work in parallel.
No they aren't lightweight, they are full-blown OS threads.
>>
A simple echo server, desu.

#!/usr/bin/env powershell

# Create a TCP server listening on port 50750
$ip = [Net.IPAddress]::Parse("127.0.0.1")
$port = 50750
$server = New-Object Net.Sockets.TcpListener $ip, $port
$server.Start()

$buffer = New-Object byte[] 1024

while ($true)
{
# Accept a client
$accepted = $server.AcceptTcpClientAsync()
$client = $accepted.Result
if ($client -eq $null) { continue }

# Read data from client and echo it back
$stream = $client.GetStream()
do
{
$n = $stream.Read($buffer, 0, 1024)
$stream.Write($buffer, 0, $n)
} while ($stream.CanRead)

# Clean up
$client.Dispose()
}
>>
>>59076726
Rust's object orientation is not that explicit or evolved as common object-oriented languages such as Java, C#, and Python as it doesn't have classes. Compared with Go, Rust gives you more control over memory and resources, so lets you code on a lower level. Go also works with a garbage collector, and it has no generics or a mechanism to prevent data races between its goroutines that are used in concurrency. Julia is focused on numerical computing performance; it works with a JIT compiler and doesn't give you that low-level control that Rust gives.


>>59076729
Rust is two year old. I don't think you can be a "high paid" programmer if you know only one language in the first place. However Samsung and Mozilla might hire you for their Servo projects.

If I had a choice between C, C++ and Rust for making a system for a powerplant I would choose Rust in a heartbeat.
>>
>>59076756
So I should learn another language if I want to make money and learn Rust if I plan to be a NEET?
>>
>>59074982
> Has a dick
> Liking it but not gay
Are you retarded?
>>
>>59076594
What language are you coming from? C?

Feel free to read >>59076300
>>
>>59076747

is that powershell on unix? you absolute madman.
>>
>>59076778
What's your point?
>>
>>59076794
I like to learn a skillset that is actually useful in the real world
>>
>>59076789

It's portable, lol.
>>
i'm gonna have an informal job interview in 1 hour

they use Ruby. any advice?
>>
>>59076806
And?
>>
>>59076836
You haven't sold me on Rust being applicable in the real world yet.
>>
>>59076834
Tell them you are an expert C kernel hacker
>>
>>59076846
I'm under the impression you are not employed yet. Want me to tell you why?
>>
>>59076865
I don't know Rust?
BTW I am employed, I work "IT". I just want to move in programming and have been studying C and C++.
>>
>>59076880
>I work "IT".
Oh
>>
>>59076807

That's fair enough, do you run it simultaneously on windows and *nix?
>>
>>59076893
So Rust shill anymore convincing arguments about Rust being applicable in the real world?
>>
File: 1486170337578.jpg (106KB, 593x578px) Image search: [Google]
1486170337578.jpg
106KB, 593x578px
Terry Davis develops a self-hosted kernel and compiler from scratch with Assembly, on a single monitor with 640x480.

Jeff Dean develops cutting-edge distributed systems using a single monitor.

Linus Torvalds manages one of the largest software projects in human history using a single monitor.

>/g/ needs 3x 30" monitors to fail at FizzBuzz.
>>
>>59076919
Wow anon you sure showed me

I wonder how we can implement a real age verification in this site.
>>
File: Selection_150.png (63KB, 574x970px) Image search: [Google]
Selection_150.png
63KB, 574x970px
>>59075706
>why do you guys hate Java so much? What has Java ever done to you?
I don't know but C# isn't getting enough hate.
>>
>>59076929
You would be surprised. I actually use an ultrawide TV
>>
>>59076939
So you admit Rust has no real application outside of your circlejerk and you want more people to learn your memelang? Is that your end game?

Tell me. Do you see Rust even being where Python is in a decade? Or is it another memelang destined for losers on a taiwanese kite flying forum?
>>
>>59076950
That's because Microsoft shills own this thread and they can't stand anything but C#
>>
>>59076957
You don't even have a job in software development, why do you sound so opinionated?
>>
>>59076969
But I plan to. So I ask again, is learning Rust the right direction to go as someone who wants a job in software development.

It seems clear from your refusal to answer, that it is a loud NO.
>>
>>59076969
I think it is very appropriate for someone who is looking to be a software developer to ask questions like how applicable a language is in finding a job and real world setting. People want to know their time is worth investing in. You however seem really upset when that people are questioning you.
>>
>>59076907

To be honest, my primary use of Powershell is whenever I need to test out .NET stuff. It's quicker to bust open a REPL to see if something works than to write a C# program to test it. My primary general purpose scripting language is and always has been Ruby.

And yes, I will use it on either Linux or Windows.
>>
>>59076997
No, learning Java certainly will. Pretty sure entry level programmers are not cut out for jobs that require you to program in C.

>why no
Because Rust is still in its infancy, but it is already proving to be the best successor to C in every way.

But may I ask what is your point in bringing in job here? You are not even employed
>>
>>59077010
>upset
not really, I'm thinking how we can implement an age verification that actually works
>>
>>59077032
>Not really
>Asked about the viability of a language in landing a job
>Dodge questions
>Project unemployment
>Insult people for asking valid questions.
You might be of age but I have no doubt you are a literal manchild.
>>
>>59077021
You were the one who insulted me first >>59076865 when all I did was ask if it was applicable in the real world.
>>
>>59077050
>>Asked about the viability of a language in landing a job
>>Dodge questions
You and I both know full well Rust's job requirements are not astonishing. Or are you pretending to be retarded? "Job viability" is not what I was discussing in
>>59076661 and
>>59076717
>>
>>59077060
Java and python is more applicable to the real world and it suits you the best. Neither learning Rust or C/C++ is going to get you hired, for different reasons :)
>>
>>59077063
I don't care. I am not him and not even involved in the argument at all. All I see is you trying to push a language onto someone who is probably looking to learn something that will get him a job and getting upset when he questions you about how Rust will get him a job. What is so hard about saying "No Rust is in its infancy. Go learn Java" from the get go?
>>
>>59077073
>C
>Not going to get you hired
You must be a special kind of tard because Embedded System hires almost exclusively C programmers. You should just shutup and stop embarrassing yourself. Same applies for C++ except different industries.
>>
>>59077073
>Neither learning Rust or C/C++ is going to get you hired
One of these is not like the other
>>
>>59077087
Protip:
Month long experience of beginner level fizzbuzzing in C is not going to get you hired in embedded systems programming
>>
>>59077073
Rust shills are this stupid
>>
>>59077075
>I don't care.
I know but please address this
>You and I both know full well Rust's job requirements are not astonishing. Or are you pretending to be retarded? "Job viability" is not what I was discussing in
>>59076661 (You) and
>>59076717 (You)
>>
>>59077102
Oh look more projection.
Is learning C in college just month long experiences of fizzbuzzing? You should learn to stop projecting.
>>
>>59077106
C babbies are pretty butthurt I see
>>
>>59077114
>learning C in college
My child, that's not going to employ you in embedded systems programming. You are free to try
>>
>>59077021
X language is going to succeed C.
This has been said since decades ago. And here we are.
>>
>>59077131
C++ already limited C to systems programming these days :)
>>
>>59077129
Actually it does. Micron hires from college all the time. Rust however?
>>
>>59077132
So Rust is going to be in C ++ position in 32 years?
>>
>>59077119
Rust shills get butthurt more cause C babbies have jobs.
>>
>>59077133
Samsung
>>
Rust shills absolutely BTFO
>>
>you can only know 1 language
>>
>>59077149
>Job market
Is that the only resort you are left with? I already said Rust is 2 years old, not many companies have adopted yet.
>>
File: 1487463346465.png (100KB, 1244x1024px) Image search: [Google]
1487463346465.png
100KB, 1244x1024px
>>59077141
Uhm, in what regards?
>>
>>59077152
Link the job pages then
>>
>>59077161
And neither will they.
>>
>>59077165
"Succeeding C"
>>
>>59077166
Ask someone else to babysit you
>>
>>59077186
It already did :) It's already a better language.
>>
>>59077188
Yeah you. You like playing with shit in their infancy with no realistic usage. Sounds like a job for you.
>>
>>59077192
>It already did :)
Which is why only Samsung is hiring for rust and you can't link those job pages "hiring". I think your criteria for succeeding is just as faulty as your brain.
>>
>>59077202
Why should I babysit you though? You haven't even started learning C and you have pretty high and mighty opinions
>>
>>59077209
see >>59077161
>>
>>59077212
That isn't me you retard
>>
>>59077212
Lmao the rust shill can't post actual jobs listing. Resorts to ad hominem.
>>
>>59077226
>Ad hominem
Where in >>59077212 did I resort to ad hominem?
>>
>>59077218
>It succeeded C
>But companies have not adopted it

succeed
səkˈsiːd
verb
take over a throne, office, or other position from.
>>
>programming thread turns into job listing thread
>>
>>59077236
Job listing is not succeeding
>>
>>59077233
Saying I haven't started learning C?
>>
>>59077246
Industry usage is.
>>
>>59077247
That's an ad hominem? LOL
>>
>>59077251
It's being adopted well enough
>>
>>59077253
Do you even know what ad hominem or has Rust made you stupid?
>>
>>59077257
Prove it
>>
>>59077260
If stating that you haven't learning C is "ad hominem" you have mental issues
>>
>>59077268
ad hominem
ad ˈhɒmJnɛm
adverb & adjective
> directed against a person rather than the position they are maintaining.

What now faggot?
>>
>>59077265
Already used in Samsung, Dropbox and Mozilla
>>
>>59077282
Yeah. Prove it. Your words count for nothing till you can back them up.
>>
>>59077291
https://github.com/dropbox/rust-brotli
>>
>>59077282
Dropbox uses Python as well. In fact knowing python is more likely to land you a job in Dropbox then rust.
>>
>>59077296
>prove Dropbox uses rust
>link random github
Lmao clutching for straws here
>>
>>59077301
Dropbox adopted Rust for decompresser, a major utility in file sharing site
>>
>>59077318
>link random github
>random
This is the current state of /g/
>>
>>59077319
Yeah, because Python was too slow for that. They're not going to do much else in Rust.
>>
>>59077318
https://www.rust-lang.org/en-US/friends.html
>>
>>59077319
https://blogs.dropbox.com/tech/2016/06/lossless-compression-with-brotli/

If you bother reading the link you added you can figure out Dropbox isn't actually adopting Rust.
>>
>>59077325
That's some low quality damage control
>>
>>59077318
https://www.wired.com/2016/03/epic-story-dropboxs-exodus-amazon-cloud-empire/
>But Go’s “memory footprint”—the amount of computer memory it demands while running Magic Pocket—was too high for the massive storage systems the company was trying to build. Dropbox needed a language that would take up less space in memory, because so much memory would be filled with all those files streaming onto the machine. So, in the middle of this two-and-half-year project, they switched to Rust on the Diskotech machines. And that’s what Dropbox is now pushing into its data centers.
>>
>>59077335
haha see >>59077329
>>
>>59077337
I'm not even the same person. I was just confirming the statement that Rust is less likely to land you a job at Dropbox.
>>
>>59077374
see >>59077340
>>
File: Cc3D-AMVIAEAjPH.jpg (33KB, 600x401px) Image search: [Google]
Cc3D-AMVIAEAjPH.jpg
33KB, 600x401px
>>59077329
>https://www.rust-lang.org/en-US/friends.html
>>
>>59077455
All that in 24 months :^)

C is confirmed kill will all those crippling bugs.
brb pressing backspace 29 times to get a shell access
>>
>it's a rust thread
Slow news day?
>>
>>59077503
You can tell who are the unemployed NEETs in this thread
>>
>>59077532
Like the one who actually has no jobs and looking for it?
>>
>>59077503
Rust shills just keep dumping their garbage.
If only they were writing and posting code themselves one could start to take them somewhat seriously.
>>
File: rust-story.jpg (110KB, 537x454px) Image search: [Google]
rust-story.jpg
110KB, 537x454px
>>59077472
> rust devs come to Co devs
> rust devs: 'Co devs, pls use rust because mozilla pr $$ pls pls'?
> Co devs: 'okay we ll use it for script which wipes ass of ceo's monkey'
> rust devs: 'FCUK YEAH RUST FRIENDS FOR LIFE'
>>
>>59077546
Can I save your meme, NEET?
>>
Rust shills on suicide watch
>>
C is garbage
>>
>>59077546
I'm OK with this post
>>
>>59077556
>typical C toddlers of /g/
>>
Rust>Java>C
>>
>>59077562
As compared to literal Rust toddlers
>>
There are people here with jobs that use all types of languages. Except Rust. No one here has a job that uses Rust.

Prove me wrong.
>>
File: slide8-680x400.jpg (37KB, 680x400px) Image search: [Google]
slide8-680x400.jpg
37KB, 680x400px
>>59077568
DId I strike your nerve there? :^)
>>
>>59077549
spread the knowledge
>>
>>59077580
Nah, C is pretty shit itself anyways. Even Java is better
>>
Is it true that Go is faster than Rust?
>>
i'm getting memed by cpp templates
>>
>>59077578
Only one of us is free enough to shill Rust here and we all know why
>>
File: Bjarne.jpg (159KB, 600x437px) Image search: [Google]
Bjarne.jpg
159KB, 600x437px
>>59077589
Are you frustrated?
>>
>write a program in Java
--n works as intended
>write a program in C
--n acts like n--

C.ucks will defend
>>
>>59077539
I don't take any languages seriously that don't have an ISO standard.
>>
File: Shellshock-bug.png (76KB, 1200x1280px) Image search: [Google]
Shellshock-bug.png
76KB, 1200x1280px
>>59077599
Because C is a broken language?
>>
>>59077606
>Falling for the C meme
is it 1980?
>>
>>59077587
Faster in wasting memory, yes.
>>
>>59077602
yes, bjarne, you make me upset
>>
D means dead
C means Cucks
>>
>>59077616
More like "too many people that are too stupid to program use C". If you can't handle a tool that won't hold your hands, don't use the tool.
>>
>>59077627
Rust means ?
>>
>>59077631
so basically no one should use C because no one can handle it
>>
>>59077641
Retarded
>>59077642
Nice projecting there.
>>
>>59077631
Pretty sure people that made OpenSSL is a bit smarter than you
>>
>>59077641
Rust means C is kill
>>
>>59077642
As compared to literally no one using Rust
>>
>>59077644
Considering they clearly don't do unit testing it doesn't seem that way.
>>
>>59077652
What is your end game here? Why are you trying to force a memelang so hard?
>>
>>59077657
Sorry anon your level of expert (((C))) kernel hacker is not worth matching with people like OpenSSL creators and Linus
>>
>>59077653
Dropbox is using Rust :^)
>>
>>59077662
Why are you defending your deprecated shitlang so hard though
>>
File: 75810h5a2ft2.jpg (220KB, 1920x1080px) Image search: [Google]
75810h5a2ft2.jpg
220KB, 1920x1080px
>>59077602
Bjarne is objectivity the most A E S T H E T I C programmer of all time
>>
>>59077667
Dropbox used Rust for their data center. The rest of Dropbox isn't using or planning to use Rust.
>>
>>59077662
Are you that college student?
>>
>>59077678
>Dropbox used Rust for their data center.
Oh, not like their data center is useful or anything
>>
>>59077669
Does Rust have an ISO standard yet?
>>
>>59077669
Because this deprecated shitlang earns me 120k a year. What does Rust do for you?
>>
>>59077689
No but it does have proper safety checks
>>
>>59077693
>Year of the lord 2017
>Writing shit code that needs safety checks
>>
>>59077691
>earns me 120k a year
gee, you are roleplaying already? You haven't even finished your C course in your community college yet
>>
>>59077700
Sorry anon your level of expert (((C))) kernel hacker is not worth matching with people like OpenSSL creators and Linus
>>
>>59077693
Won't matter if my code doesn't compile anymore (or worse: computes the wrong result) in ten years because the language designers decided that rewriting part of the language spec was a grand idea.
>>
>>59077701
>Typical Rust fag reaction when confronted with the fact that there are people earning money in jobs that use C
>>
>>59077691
>120k/year
Are you the savior of C in /g/ in your spare time, anon?
>>
File: 1485798520175.jpg (35KB, 385x375px) Image search: [Google]
1485798520175.jpg
35KB, 385x375px
You ever just feel like giving up while trying to learn programming? I feel like dropping out and finding a different path. I can't even tell what's going on anymore.

Any other anons ever felt like this? How did you get past it?
>>
>>59077717
That is not a lot. That is like the basic entry salary for someone who is working in silicon valley. Even code monkeys for shit start ups get that much.
>>
>>59077716
anon can you give me like a grand or two to hiro so they can stop rust shills

your 120k a year is greatly helpful in our /g/
>>
>>59077729
When did I say that's a lot? Can you reread?
>>
>>59077730
That is pre taxes and pre bay area rent money.
>>
Rank these programming languages from best to worst:

D
Rust
OCaml
C
Go
Haskell

Remember, there is a correct answer.
>>
>>59077780
I love both D and Rust
>>
>>59077780
Rust
Haskell
OCaml
C
D
Go
> Remember, there is a correct answer.
I know.
>>
>>59077706
The problem is money and testing, Linux kernel got lots of old bugs because they were written in a hurry and never looked at again.
It's a constant of merging more code and less time to check older written code that is sloppy.
OpenSSL is known for it's bugs and that's why LibreSSL exists now with a lot of code removed.
>>
List of all programming languages that actually matter:
https://en.wikipedia.org/wiki/Category:Programming_languages_with_an_ISO_standard
>>
>>59077796
bullshit Linus is a fucking noob that can't even write proper C code. Thus he made mistakes and bugs,

I bet he can't even dream in code like me
>>
>>59077803
>If it doesn't have an international commie standard it doesn't matter!
>>
Hurr durr noobs making bugs

Make bug free code like real /g/entoomen. :D:D:DDD
>>
>>59077813
Have fun learning your moving target languages/compilers and getting cucked by the jews controlling them.
>>
>>59077829
This

Rust is a cuckold communist trash. C is for true white males and not controlled by kikes deus vault
>>
Which language users are the easiest to trigger here. There is one right answer.
>>
>>59077838
C.ucks
>>
What language would one learn after C basics ?
Rust or Haskell or C++ or Common Lisp?
>>
I think C should have a separate thread
>>
>>59077853
Rust or Haskell
>>
>>59077855
They have: >>59076300
>>
Rust > D > Go > C > OCaml > Haskell
>>
>>59077860
It's not pro-C

I feel like C fags are bullied constantly for the last few days
>>
>>59077864
Anon, I couldn't agree more
>>
>>59077867
Because Mozilla decided to spend some of their SJW money for paid shills.
>>
>>59077875
Open catalog and count how many anti mozilla threads you made, anon
>>
>>59077881
>uncertain claim
>respond with ad-hominem
Don't worry, nobody will notice!
>>
>>59077867
Good. Weeds out the people who shouldn't be using C.
>>
>>59077889
>>uncertain claim
Anti firefox threads are a common phenomenon
>>
>>59077892
Like everyone?
>>
This rust shilling really makes me never want to touch the language...
>>
>>59077896
Even if it is, that is still no justification to sink to the same level. Unless you're in elementary school, maybe.
>>
>>59077901
Anyone who cares about what people think of their language at least.
>>
>>59077908
Now that's ad hominem
>>
>2017
C++ and C are deprecated
>>
Seriously, how did people get anything done before Python or Java?
>>
>>59077946
They didn't
>>
>>59077946
using their brain
>>
>>59077858
>rust
is this bait?
>>
>printf()
>turns out it's not secure
Dropped

When did you drop C, /g/?
>>
Any good books on Rust for beginner ?
>>
>>59077972
Rust is not really a beginners' language like C. But O'Rielly is making one
>>
>one poster shills a programming language
>insults random people just because they like/use other languages
>never posts any code or projects
>doesn't get banned
Never change /dpt/
>>
>>59077967
>turns out I'm retarded
we all knew
>>
>>59077988
>printf
>not secure
>ur retarded
Are you a BSD user?
>>
>>59077984
>Mom ban them they hurt my C
>>
>>59077786
>i love D
thats what she said
>>
>>59077972
pick one yourself
http://flavorwire.com/518203/17-pathbreaking-non-binary-and-gender-fluid-novels
>>
>>59077972
https://doc.rust-lang.org/book/
>>
>>59077972
Rust essentials
>>
>>59077981
Kinda sucks, how would one learn what is needed for rust ?
>>
>>59077967
printf is secure tho
>>
>>59078018
I'd suggest >>59078011 and >>59078015
>>
>>59077962
>implying Google™ Telepathy® device will have been released before 2020
>>
>>59078028
>>59078011
>>59078015
Thanks senpai!
>>
>>59078025
>Avoid Single-Argument printf s 3
One such guideline is to avoid using printf with a single string argument. If you need to dis-
play a string that terminates with a newline, use the puts function, which displays its string
argument followed by a newline character.
>>
>>59078044
from "The CERT C Secure Coding Standard"

yeah it's a thing
>>
>>59078044
>>59078060
Or you know, you could use it like it's intended.
printf("%s\n", str);
>>
Why is C++ a bad language suddenly ?
>>
>>59078044
>If you need to dis-
>play a string that terminates with a newline, use the puts function
well, yeah, that's its purpose
>>
>>59078069
That's the true C experience™

While rust users use println!(); and moving on
>>
>>59078081
ur meme language makes even less money than C
($0)
>>
>>59078081
>needing to use a template to print some text to a console
Okay,
>>
>>59078089
system.out.println("poo") get's you more money
>>
File: rust-oreily.jpg (390KB, 1024x1344px) Image search: [Google]
rust-oreily.jpg
390KB, 1024x1344px
>>59077981
>O'Rielly is making one
they actually released it yesterday
that's why we have a spike in rust discussion today
>>
>>59078097
it doesn't, it can't even compile
>>
>>59078096
Rust engineers security and convenience for the users :%)
>>
>>59078096
And people make fun of C++.

>>59078102
fucking lol'd
>>
>>59078106
what
>>
>>59078116
IT DOESN'T, IT CAN'T EVEN COMPILE!
>>
>>59078116
He's arguing typos.
Either that or he's even more retarded or claiming that compiling to bytecode isn't actually compiling.
>>
>>59078125
System.out.print("You can suck my cock, autist");
>>
>>59078102
>he was mad enough to made this
Looks like the trolling is working tho.
>>
>>59078138
As if C toddlers have anything else to do
>>
>>59078137
>REEEEEEEEEEEEE
>STOP RAPING MEEEEEE
>>
noobie question:

wtf is this pointer to a pointer shit?
i hae a linked list, **list

honest question:
why the fuck would someone write this? why would you not just pass the reference?

why:

<code>
list ** delete_node(node **list){
list->next = nil //whatever
return list
}
</code>

not:

<code> list *delete_node(){ ...} ;
delete_node(&list);</code>

3rd question: why the fuck can you just loop through **list? and the node is already dereferenced.
>>
>>59078153
Did I activate your almonds there, C toddler?
>>
>>59078076
>suddenly
It's actually slowly improving now, but a new well developed language without the baggage would be much better.
>>
>>59078160
>gets BTFO
>toddler tho
>>
>>59078102
This is great
>>
>>59078174
>btfo
what
>>
What should one be learning after beginner algorithmizations and similar very basic programming? I just started my second semester (HS teacher's course) and the pace feels a bit slow.
>>
>>59078156
how would you even build a pointer to pointer in the real world

list = Node{ nextnode };
idiot_ptr = &list;
delete_node(&idiot_ptr) ? wtf
>>
>>59078186
>algorithmizations
>HS teachers' course
lel
>>
>>59078160
wanna suck some emu meatballs?
>>
@59078192
0/10
>>
>>59078199
>THIS mad
C.ucks everyone
>>
>>59078156
Come on, you know what the difference between getting the address of a parameter and passing the pointer is. It's the same with pointers-of-pointers as it is with pointers-of-values. The top one will change the passed *list, the bottom one will just change a copy.
>>
>>59078215
>I got rekt multiple times
:^)
>>
>>59078227
>I got rekt
what
>>
>>59078215
>dodging the question
come on lad
>>
>>59078221
yea i f'd up the function definition on the 2nd code sample
obviously it should take a param of a pointer type

ex list *delete_node(node *list){ ... }
>>
Hi.
I posted a question about Flash' ActionScript in /ic/ animation thread but nobody seemed to know the answer and I was told to go to /g/. I'll just copypaste the question. If there's another place I should go with it, let me know.

"To simplify things, let's say the screen starts with a prompt "Which clip would you like to watch?" and a text input box below. If the user puts in "1" and confirms, a clip plays on the screen. If the user puts in "2", another clip plays. If anything else is put in, nothing happens.
Does anyone know where to start? It doesn't have to be flash. Any tool will be good if it gets the job done."
>>
>>59078301
youtube actionscript tutorial
>>
File: asm_hello.png (131KB, 1436x568px) Image search: [Google]
asm_hello.png
131KB, 1436x568px
while rust retards shill, noone is gonna notice muh clion has asm highlight now
>>
New thread:

>>59078314
>>59078314
>>59078314
>>
>>59078240
I'll give you a practical example.

// List is essentially a 2-D array, but the length of the
// second dimension isn't necessarily fixed.
node** clear( node** list, int length) {
int i=0;
for( i=0; i<length; ++i)
free( *(list+i));
free(list);

// If list was passed as a pointer, this change would not change
// the list that was passed, leaving the user with a non-null
// pointer that is pointing to garbage data
list = NULL;
return list;
}

It's been forever since I used C, so there might be some syntax errors in there.
>>
>>59078374
right thats the code i have

but im confused what ** is i think.

why would u do something like this, to be able to use that function.


list = Node{ nextnode };
idiot_ptr = &list;
delete_node(&idiot_ptr);

? wtf
in other words why not use a reference ex

node* clear( node* list, int len);
clear(&list);
>>
File: ppint.png (14KB, 671x380px) Image search: [Google]
ppint.png
14KB, 671x380px
>>59078395
A ** is a pointer to a pointer. It's pointing to a place in data where a bunch of pointers are stored sequentially in memory (or potentially it could just be a single pointer, but what would be the point of that?).

For example, if you have a 2D array. int board[4][8];. board is basically an int**. It points to the the 4 int* pointers and each of those 4 pointers point to 8 ints.

Pointers to pointers are used frequently in raw caches and data streaming. How you refer to them in your own code is up to you, but for the function it's important that the pointer to a pointer is passed and not just the single-layer pointer (because those are two completely different things).
>>
>>59078458
so is that kind of fn definition somefn(list ** node) ... dont because the person used this code-style to create their list?

node& list = node { someshit };
>>
>>59078495
desu ive never seen & on the left side of an equals sign, for 10 years ive used it like int* bar = &baz
>>
>>59078495
It was necessary, because it's describing what it is. It's a pointer to pointers. You could also cast it to a single void* (a pointer to data which you don't know what it is), but int** is more descriptive.
>>
File: 1487793500144.jpg (121KB, 551x551px) Image search: [Google]
1487793500144.jpg
121KB, 551x551px
>>59076387
Also interested in an answer to this
>>
>>59078044
>>59078069
Surprise surprise, compilers actually optimize
printf("%s\n", str);
to
puts(str);
.
Thread posts: 340
Thread images: 20


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