[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 25
File: K&R himegoto waifux2.png (1 MB, 1000x1400) Image search: [Google]
K&R himegoto waifux2.png
1 MB, 1000x1400
old thread: >>54363022

What are you working on, /g/?
>>
Recursion is not a joke.
>>
>>54370229
recursion is a parlor trick tho.
tail call recursion is compiler abuse
the most common example of recursion (fibonacci series) also happens to be the most computationally expensive example of recursion i've ever seen
>>
why was last thread deleted
>>
gonna repeat my Q so that we all can learn...

hey /dpt/, when applying to a job, how do you respond to the questions asking you for your motivation to work in the companies?

I just write "I want to learn blahblah and I want to contribute with my skills and knowledge". what should I write instead?

>>54370219
again, thanks f.a.m.
>>
>last thread deleted
>before I could crack a joke at the "fampai" Anon with a "fampai'er pun"

Damn.
>>
>>54370278
>applying
This doesn't seem programming related. You will almost always be asked to send a resume and not fill out some online job application where 9/10 applications are purposefully sent to /dev/null.
>>
Is it better to focus on one language only when programming? I've been learning C/C++ because I thought since they were in the same family it might be a good idea to just learn them both, but the subtle stylistic differences trip me up sometimes, and implementing solutions in OOP and procedural programming is a wee bit of a strain on my brain.

I guess I was wondering because I'd also like to learn a little bit of x86/x64 assembly. Should I stick with just C/C++ for now?
>>
>>54370278
fucking HR fucks
Just look for something you might like on that company and accentuate on it.
>>
>>54370313
I would follow one and then flow to the other, they're different approachs. Also C++ has way more features than C. With what I know now I would.
C -> asm -> C++
>>
>>54370253
If you do shit like walking a tree with iteration, You should straight up kill yourself.
>>
>>54370313
C and C++ are completely different languages, and under no circumstances is it useful to think otherwise.
Just learn C.
>>
>>54370313
I'd say learn what you need and avoid anything superfluous. I mean, what do yu need C / C++ for? Anything in mind yet? How would ASM benefit you?
>>
I'm reading The Go Programming Language right now, and while I eventually understand every example, it really sucks that I can't explore individual functions further in some kind of REPL. I have to construct an entire program around that case and compile it. It feels like I'm learning at a snail's pace.
>>
>>54370353
Learn C because everything is C. Learn an asm to understand C.
>>
>>54370313

You should focus on one language when you are just starting, but it is of worth to learn multiple languages as you progress. As for wanting to learn assembly... you can learn that in tandem with C and C++. In GCC, if you compile with the -S flag, you can get an assembly output to see what exactly your code translates to. Something I would encourage you to do is to dig under the hood and see how crap works as much as possible. It is both fun and enlightening to see the ugly internals of programs.

>>54370253

>compiler abuse
No such thing. If you know your compiler will optimize it, you should always use whatever is most convenient. Sometimes that's a for loop, sometimes that's a tail recursive call.
>>
>>54370316
HR is a self-perpetuating meme.
It's where firms dump all their women and minority hires to fill quotas.
Who in turn tell the firm they need to hire more women and minorities.
>>
File: 1447058908157.jpg (47 KB, 1024x576) Image search: [Google]
1447058908157.jpg
47 KB, 1024x576
Whenever I want to remove an item from a singly-linked list, I pop the entire linked list to a temporary array and then push every item back minus one item.

It's much easier to think about than writing edge cases for keeping track of the previous node when traversing a linked list and then decoupling it by hand.
>>
>>54370410
God damn, that is stupid.
Also, you can easily avoid edge cases by using pointers to pointers.
>>
>>54370410
>I pop the entire linked list to a temporary array and then
It's not too late to quit CS
>>
>>54370327
This is kind of what I ended up doing anyway. Classes are a pain considering most of my projects are very small. That being said, I thought templates were a really cool feature of C++.
>>54370338
but isn't C++ a superset of C?
>>54370353
don't tell anybody, but it's for gamedev. Also, I'd like to make custom video game hardware, because I've been kind of dissatisfied with the low quality controllers I find these days, so I want to make the greatest controller ever, so I'm kind of looking to attain an extremely fluent understanding of driver software / hardware interfacing, and I've heard assembly is used for that.
>>54370377
dubs speak truth
>>54370385
but are C/C++ one language? The other guy says otherwise.
>>54370338


Tbh lads, I'll think I'll focus on C and asm, and move onto C++ when my projects start getting beyond a few megs in size.
>>
>>54370452
>but isn't C++ a superset of C?
Not even close.
>>
>>54370452
>C++ a superset of C
const int *class;
int *new = &class;
>>
Where are they getting 8192 as the block size?

http://www.slideshare.net/tarnavski/how-inodes-work-presentation
>>
>>54370410
>doing something in a horribly expensive method because its "easier to think"
See? Thats why women shouldn't get into programming.
>>
>>54370485
int array[n];


:^)
>>
>>54370508
int *array = malloc(sizeof(int) * n);


:^)
>>
Any regex wizards here?

I've got this:
\[url=(?:&#34;)?((?:https?:\/\/)?[^\s<>"]+|www\.[^\s<>"]+)(?:&#34;)?\](.*)\[\/url\]


The quotation marks are supposed to be optional, and it's working fine for the opening one, but it captures the closing one even though I'm using a non-capturing group, so this:
[url="something"]asdf[/url]


Will yield:
something"
asdf


But I want only something, without the ending quotation mark.

Another issue is that I use something like this for spoiler tags:
r'\[spoiler\](.*)\[/spoiler\]


However, when I have multiple spoiler tags it will match everything in between the very first opening tag and the very last closing tag, I guess it has to do with me using (.*) but I'm not sure what'd be a good pattern to match almost all the stuff.
>>
Fugg, I'm getting all these offers for web dev jobs and I can't take them because pretty soon Squarespace will replace the front-end and I'll be out of a job.

It won't take away back-end, will it?
>>
int *j = static_cast<int*>(malloc(sizeof(int) * 5));


c++ is beautiful
>>
>>54370503
but anon, computer time is cheap, developer time is not :^)
>>
>>54370452
Doesn't sound like a bad plan. I mean, for gamedev I would really go for C++, but you'll be fine with C. In fact, it's even better that you'll be focussing on lower level code which is more appropriate for what you're ultimately going for.
>>
>>54370558

Just fucking type
int *j = new int[5];
like a normal fucking person.
>>
>>54370585
GET OUT NORMIE FAG
REEEEEEEEEEEEE
>>
make this shit print out the return values im drunk
public static int gold(int x, int y) {

if (x == y)

return 0;

else

return gold(x-1, y) + 1;

}

public static void main(String[] args){
gold(9,3);
}
>>
>>54370410

What edge cases?

void remove_next(struct list_node *node)
{
struct list_node *tmp = node->next;
if (tmp) {
node->next = tmp->next;
free(tmp);
}
}


>>54370452

C and C++ are different languages, but a large subset of C is also valid C++. This subset of C is large enough that libraries can be written in C that are usable in C++ using the same header files. That said, you should note that not all C is valid C++, and a lot of C++ is not valid C. Furthermore, it is not wise to program C++ as one would program C, because there are a number of features in C++ that are particularly useful, with no cost to the programmer whatsoever. That does not mean, however, that one needs to use every feature of C++, or that one should prefer the C++ standard template library over other implementations of various data structures (std::string is convenient at many times, but not always the best solution for a string class).

>>54370558

Better:
auto j = std::make_unique<int[]>(5);
>>
>>54370618

Learn to indent.
>>
>>54370624
>What edge cases?
The head is the node being removed.
>>
This sucks.

I've been hunting for a job for a month and I still have nothing to show for it. Why is it so hard to get a software developer job /g/?

I guess it's my fault for taking those fucking internships in web development, because now I can only get a job in web dev and in 5-10 years I'm going to be fucking unemployed
>>
>>54370585
is that equivalent to
int j[5] = {};
?
>>
>>54370642
>int j[5] = {};
That is automatic memory (stack allocated), while the other is dynamic memory.
Also, there is supposed to be a 0 inside the array initialiser.
>>
>>54370639
Where do you live?
>>
>>54370642
no, in C++98 and C++11 its the uniform initializer

new allocates memory on the heap and returns a pointer to it, calling the ctor directly allocates it on the stack

>>54370656
{} does aggregate initialization here, which you do have to eventually call the value initialization (0 for your example)
but in c++11 you can just do
int j[5] {};
>>
>>54370701
New York City
>>
>>54370638

Make a wrapper struct.

struct forward_list {
struct list_node head; // Head node contains pointer to first node
struct list_node *last; // For easy insert at end
};
>>
>>54370799
this is literally spaghetti code
>>
>>54370799
It's still a special case.
The non-retarded way is
void list_remove(struct list **head, int n)
{
for (struct list **curr = head; *curr; curr = &(*curr)->next) {
struct list *entry = *curr;
if (entry->val == n) {
*curr = entry->next;
free(entry);
return;
}
}
}
>>
>>54370807

Anon, that's just a simple wrapper struct. Idea is to call remove_next on the forward_list's fake "head" to remove the first node from a list. Of course, if you don't like that option, an alternative might be to have a separate function for removing the front:

struct list_node* remove_front(struct list_node *node)
{
struct list_node *tmp = node->next;
free(node);
return tmp;
}
>>
>>54370901
>>54370887
or you know...

you could simply dump the entire list to an array and then push it back?
that way you don't have to maintain dumb exceptions and "fake head" pointers to maintain consistency in your linked lists
>>
>>54370915
My two-star code doesn't have any exceptions. It will work if you give it the head, the tail, or any other element.
>>
>>54370219
Why doesn't this code work? It doesn't print the concatenated string.

void string_cat (char *destination, char *source)
{
while (*destination != '\0') {
destination++;
}

while ((*destination = *source) != '\0') {
destination++;
source++;
}


printf("The concatenated string for 'this_string' and 'that_string' is %s.", destination);

}
>>
>>54370932
>printf("The concatenated string for 'this_string' and 'that_string' is %s.", destination);
Because destination now points to the end of the string.
Print the string outside the function instead.
>>
File: dafuck.png (6 KB, 860x239) Image search: [Google]
dafuck.png
6 KB, 860x239
Can someone help me out a nooby here?

Doing a hangman game and the logic is screwed as shown in screenshot because I'm not sure how to get it to add a guess count after its ran through the whole word and found no match whereas now I believe it's doing a guess check for every single letter in the word.
>>
File: 1374809829094.gif (974 KB, 500x281) Image search: [Google]
1374809829094.gif
974 KB, 500x281
I notice there's a lot of anime in these threads.

That's very interesting, since there was a lot of anime in the desktop threads and those threads are now dead.

I'll be very interested in how much anime I see in these threads in the future, and whether or not they have anything in common with the desktop threads that are now deleted, because they were full of anime.

Very interested, yes, very interested indeed.

It's a new order, and you'd all best pay attention. I wouldn't want anything to happen to you, or to your favorite thread.
>>
>>54370985
Jesus christ, how new are you?
>>
>>54370985
mods are pissed off because some shitposter was making 20 concurrent desktop threads in a row and shitting up the board
>>
MIT license says that I need to include copyright and licensing notice in all copies or substantial uses of the work.

If the library itself already has the copyright and licensing notice, do I need to include a notice in the code that calls the library? If I use two libraries, both have different licenses (IE. MIT and Apache) how would I include the notice?

Thanks in advance.
>>
>>54370887

O(n) removal of elements from the middle of a list defeats the purpose of using a linked list in the first place. You have substituted one bad solution for another.

>>54370915

>Shlemiel gets a job as a street painter, painting the dotted lines down the middle of the road. On the first day he takes a can of paint out to the road and finishes 300 yards of the road. "That's pretty good!" says his boss, "you're a fast worker!" and pays him a kopeck.
>The next day Shlemiel only gets 150 yards done. "Well, that's not nearly as good as yesterday, but you're still a fast worker. 150 yards is respectable," and pays him a kopeck.
>The next day Shlemiel paints 30 yards of the road. "Only 30!" shouts his boss. "That's unacceptable! On the first day you did ten times that much work! What's going on?" "I can't help it," says Shlemiel. "Every day I get farther and farther away from the paint can!"

Have you considered the reason why no one else with a brain does things your way?
>>
>>54370952
How do I make destination a global variable?
>>
>>54371043
foo foo code goblin
>>
File: 1432162002562.jpg (73 KB, 543x549) Image search: [Google]
1432162002562.jpg
73 KB, 543x549
>>54370219
I'm interested in learning how to program. Is the programming course on Khan academy a good place to start?

https://www.khanacademy.org/computing/computer-programming
>>
>>54371048
>O(n) removal of elements from the middle of a list defeats the purpose of using a linked list in the first place. You have substituted one bad solution for another.
You can easily generalise the code to scan over the entire list, deleting nodes which match some predicate, or only delete the node currently being pointed to.
The whole point of it is that double indirection is better than single indirection.
>>
Is the extern keyword in C only required when you want to be able to access a variable in a file that is included via the preprocessor? When I tried it with two source files I just compiled together the variable had the same address in both files even w/o the extern keyword. How?
>>
>>54370901
>Of course, if you don't like that option, an alternative might be to have a separate function for removing the front:
Or just have only that function.
remove_front() will work for all nodes.
>>
Just applied for another round of jobs. Now to wait till tomorrow when a single one of them will wake me up with a phone call and then never respond again afterwards no matter how charming or knowledgable I come off
>>
>>54371108
>The whole point of it is that double indirection is better than single indirection.
Linked lists with one level of indirection is bad enough, you just made it even slower.
>>
>>54371160
>you just made it even slower
Do I didn't. You only need the double indirection when walking the list.
You have the pointer to the pointer to the node. That's already with the node, so you don't have any worse locality.
>>
>>54371184
To get to entry-val you have two levels of indirection.
>>
>>54371108

Fair enough, but given that this is the kind of idiot to destroy an entire linked list just to remove one node, it would probably be best to actually provide an implementation that uses predicates, instead of just "delete nth node"

>>54371125

Yes, and then it's the caller's responsibility to make sure that the previous node's next pointer isn't invalidated. Not entirely ideal.
>>
>>54370330
no YOU kill yourself, you should NEVER have recursive function calls, recursion literally has blood on itself, it's despicable, you should reevaluate you life and who you want to be
>>
>>54370749
Silicon Alley.
>>
guys how do i make the double into an int?!?! quick

}else{
return populationSize(startingPopulation*Double.toInteger(increaseRate),increaseRate,numberOfDays-1);
}
>>
>>54371300
Never heard that phrase before (which makes sense since NY barely has any alleys), but it doesn't change the fact that after a month of searching with one lead I'm fucked unless I cave and take a web dev job
>>
>>54371319
just get a backend job
im writing this from my webdev job, and i spend 5/8 hours shitposting
>>
>>54371317
do you mean a double into an int, or a Double into an Integer. Java makes a distinction between types and their class forms

for double -> int just use
double i = 20.0;
int j = (int) i;


for the class
Double i = new Double(20.0);
Integer j = new Integer(i.intValue()); //Note: intValue() returns an int
>>
>>54371367
I guess, but I want a job that isn't going to be extinct in 5-10 years
>>
File: 1447921043042.jpg (7 KB, 180x210) Image search: [Google]
1447921043042.jpg
7 KB, 180x210
>>54371402
>webshit extinct in 10 years
>>
>>54371057
declare it as static if you want it global in a single file, or extern if you want it global across the whole program

>>54371424
I shouldn't say "extinct", but what I mean is that an influx of kids who learned coding in high school will oversaturate a market already trivialized by the advent of shit like squarespace. Web dev will still exist but it will be reduced to web design unless the foundation of the company is some complex engine that isn't even written in web dev languages
>>
>>54371424
>i spend 5/8 hours shitposting
m8...

just look at what happened in the dotcom bubble... and now is the same just a little bit less ridiculous
>>
>>54370452
C++ started out as a superset of C, but rapidly evolved into a whole different beast.
You can 'code C in C++' but that's about it.
Basically:
If you want to program kernels or AAA vidya gaems, learn C++.
If you want to program uControllers and high performance programs, and also just gain a very useful language that makes it easy to learn all other languages (you'll basically just have to add OOP + functional programming) and runs on everything(tm), learn C.
>>
>>54371280

If a function is tail recursive, it will never cause stack overflow as long as the developer isn't a retard who forgets to turn on optimization flags.

If a function isn't tail recursive, there is an implicit stack. An iterative equivalent would have to create a stack data structure on the heap to store backtracking information. This stack would necessarily have to be able to grow (if you could put a bound on the amount of memory needed, you could just use normal recursion and request enough stack space), and could run out of memory just as one could by running past the end of a call stack. The end result is the same.
>>
>>54371477
I was using the wrong variable. I was supposed to print the string that was concatenated, not the pointer.
>>
It kind of looks like unless I start a company all on my own I'm shit out of luck in the jobs department

At least I have an idea, but it's going to require a metric fuck-ton of data entry to get started unless I figure out how to parse an ebook just right, and even then I have a lot of work to do on my own just to make something that probably already exists
>>
>>54371604
>The end result is the same.
The explicit stack is better because you avoid function call overhead.
>>
>>54371385
i should have put the methd headr
i just wanted to convert increaseRate to int when multiplyng startingPop. i just needed (int) next to it
>>
How do you guys manage your time, how do you get good at it?
>>
>>54371648

And instead get realloc overhead, which is worse.
>>
>>54371805
he asked /dpt/
>>
>>54371818
woops, you forgot to put meme arrows on that post there. no worries, mods will fix that with a quick ban :)
>>
>>54370618
wow this is shit.
Bullshit "lel recursion" excercise.
basically:
if (x<y){
return x-y;
}
return 0;

just in a horribly complicated way.
>>
>>54371842
I meant x>y of course.
>>
>>54371814
in a reasonable program you will know ahead of time the size of the tree or an upper bound
>>
>>54371854

In which case there is nothing wrong with using recursion, because you can always increase the size of the stack to however big you need it to be.
>>
>>54371924
it's not even unintuitive at all to use an explicit stack for tree traversal

recursive function calls are a meme
>>
wanna learn löve for gamedev
simple programming seems pretty easy but the retard-oriented "make gaymes with löve" -guides give a really naive explanation of lua.
How do I into lua/löve? Any good books? Tutorials?
>>
>>54372027
>retard-oriented
>naive
that's literally what lua/löve is
>>
>>54372046
dude i just want to make stupid simple games without getting neck-deep in SDL shit or Unity or Meme Maker studio
>>
>>54372068
you could try asking in >>>/vg/agdg maybe someone there knows more about löve or which tool would suit you
>>
>>54372068
unity and game maker is about as easy as it will get anon
>>
>>54371943

Never said that it was unintuitive, just that it gained no benefits.
>>
>>54372068
Just make your games in an HTML canvas. Easiest shit ever.
>>
>>54372112
yeah with lua/löve you're still doing programming, i'd imagine that unity and game maker have a lot more shit built in
>>
whats the return vales you should use in C?

i do
0 -> all good
1 -> small error
2 -> you dun goof'd
>>
>>54372139
#include <errno.h>
>>
>>54371842
no wait, you could put any value in the method's arguments, dismiss the 9 and 3. also u frgt 1
>>
>>54372139
EXIT_SUCCESS and EXIT_FAILURE
I would print to stderr to describe what went wrong.
>>
>>54372157
Well, in the case that x is bigger than y, the return value will always be the difference between x and y.
I did not notice something though:
In the recursive shitcode, if y>x, the program goes into an infinite loop and crashes.
>>
>>54371814
>And instead get realloc overhead, which is worse.
No.
>>
>>54371924
You still have the function call overhead.
Fixed size explicit stack is the way to go.
>>
>>54372112
>>54372127
The overhead in Unity and Game Maker is fucking gigantic and your only options are ultra-heavy physics engines even if you want to make simple tile-based shit. Bonus: Game Maker uses "Game Maker Language" and Unity has C#, both meme languages. So pick your poison.

>>54372098
Thanks, will do.
>>
>>54372139
0 = success
non-zero error codes have defines/enums.
>>
>>54372361
lua is fucking slow you'll have an "overhead" there just as well

you can't have your cake and eat it too, either do it properly or settle with some very shitty shit
>>
>>54372381
Lua has overhead, but compared to GM or Unity you're still over 9000 miles ahead.
C >>>> lua >>>>>>>>>>>>>>>>>>>>> Unity >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> GM
>>
>>54372386
kill yourself löve is slow too
>>
>>54372361
>want to make simple game without much coding
>muh meme language
>muh overhead
kill yourself
>>
>>54370219
i'm working on your girlfriend
>>
>>54372386
>>54372391
look it's using fucking deprecated fixed function opengl

https://github.com/love2d/love/blob/master/src/modules/graphics/opengl/Graphics.cpp
https://github.com/love2d/love/blob/master/src/modules/graphics/opengl/SpriteBatch.cpp

even unity would probably be faster
>>
>>54372412
>>want to make simple game without much coding
where did i say this?

>>54372412
are you implying that GML is not a meme language?

>muh overhead
if the endgame is gonna be a simple platformer, Unity or GML will have exponentially large unnecessary shit in compared to löve. fact.
>>
>>54372441
>dude i just want to make stupid simple games without getting neck-deep in SDL shit or Unity or Meme Maker studio xD
>>
>>54372441
>are you implying that GML is not a meme language?
explain what a "meme language" is
>>
>>54372470
>i can hello world in c and fibonacci at best,so im better than all of you
>>
>>54372501
KILL YOURSELF AND FUCK OFF TO >>>/vg/agdg STUPID UNDERAGE/RETARDED ENTITLED MILLENNIAL SHITKID
>>
>>54372519
>I didnt take my meds today

;>)
>>
Can anyone debug this for me please, it's for a project due in a few hours. It was completely functional but I completely forgot I had to include more functions and I'm just confusing myself. I'm getting the error message that the "int" isn't callable.

http://pastebin.com/zqCKzzAY
>>
>>54372528
>>it was functional

>what is git
>>
>>54372524
kill yourself fag yeah i'm sure you'll make it big with your zero effort indie hipster game
>>
>>54372571
>kill yourself fag yeah i'm sure you'll make it big with your zero effort indie hipster game

>>54372524
>>54372524
>>54372524
>>54372524
>>
>>54372578
nice game you got there champ
>>
How do I get access to parent variables?
Do I just inherit the parent or something.
What I mean is that in the constructor is
class parent
{
parent()
{
child=new child();
}

so in the child Id like to access the parent.
>>
I just fluked an easy recursive implementation of bfs
am i a bad person?
>>
>>54372656
bfs?
>>
>>54372770
breadth first search
>>
File: straw.webm (983 KB, 1280x720) Image search: [Google]
straw.webm
983 KB, 1280x720
Ask your much beloved programming literate anything. (IAMA)

>>54370452
>but isn't C++ a superset of C?
http://www.stroustrup.com/bs_faq.html#C-is-subset

>>54370410
Sauce ?
>>
>>54372789
kill yourself
>>
>>54372656
how would you do it, I have no idea

seems complicated
>>
>>54372789
>>54372809

I think he means "Would you please kill yourself?"
Presumably it's because you're asking for sauce
>>
>>54372789
at least u don't have a trip
>>
>>54372822
it's a secrit
>>
>>54372841
stop shitposting fagit
>>
File: if only.png (219 KB, 789x648) Image search: [Google]
if only.png
219 KB, 789x648
I still don't get the connection between traps and programming.
>>
>>54372656
>>54372822
we're not doing your homework fag
>>
>>54372961
there is none it's just a shitty forced meme

except for haskell and rust fags those are realtively often mentally ill mutilated sickos
>>
why aren't you gaylords coding in golang?
>>
>>54372985
it's even shittier and more useless than C#
>>
>>54372985
>>54372994
or go is probably less shitty (because C# is ridiculously shit) but it's still more useless than C#
>>
>Want to try out Vulkan
>Laptop doesn't support amdgpu
>Can blacklist radeon/force load amdgpu and use vulkan headless from a pty, but WM crashes on login in that state
Nice to see AMD's driver support is as good as ever.
I have dual graphics cards, and the shitty 'G' one is no longer supported, but the more powerful 'M' one is. Thanks AMD.
>>
>>54373002
>C# is ridiculously shit
Nah bro. C# is good. It's Java done right.#

It's .NET that's the bullshit.
>>
>>54372975
>implying gender nonconformity is a mental illness
>>
>>54371184
Ricer.
>>
Can anyone help me with compiling the GLFW sample program?

> gcc main.c -lglfw3 -lopengl32

ccQcyzy9.o:main.c:(.text+0x43): undefined reference to `glfwSetWindowShouldClose'
ccQcyzy9.o:main.c:(.text+0x67): undefined reference to `glfwSetErrorCallback'
ccQcyzy9.o:main.c:(.text+0x6c): undefined reference to `glfwInit'
ccQcyzy9.o:main.c:(.text+0xa8): undefined reference to `glfwCreateWindow'
ccQcyzy9.o:main.c:(.text+0xb6): undefined reference to `glfwTerminate'
ccQcyzy9.o:main.c:(.text+0xcd): undefined reference to `glfwMakeContextCurrent'
ccQcyzy9.o:main.c:(.text+0xd9): undefined reference to `glfwSwapInterval'
ccQcyzy9.o:main.c:(.text+0xec): undefined reference to `glfwSetKeyCallback'
ccQcyzy9.o:main.c:(.text+0x10a): undefined reference to `glfwGetFramebufferSize'
ccQcyzy9.o:main.c:(.text+0x1c5): undefined reference to `glfwGetTime'
ccQcyzy9.o:main.c:(.text+0x2f6): undefined reference to `glfwSwapBuffers'
ccQcyzy9.o:main.c:(.text+0x2fb): undefined reference to `glfwPollEvents'
ccQcyzy9.o:main.c:(.text+0x306): undefined reference to `glfwWindowShouldClose'
ccQcyzy9.o:main.c:(.text+0x319): undefined reference to `glfwDestroyWindow'
ccQcyzy9.o:main.c:(.text+0x31e): undefined reference to `glfwTerminate'
collect2.exe: error: ld returned 1 exit status


I copied the contents of lib-mingw-w64 to the lib folder of my MinGW installation.
>>
You should be able to tell me what this code does /dpt/:
template<typename T, size_t N>
constexpr size_t f(const T(&)[N]) {
return N;
}
>>
>>54373137
you should be able to do your homework yourself pajeet
>>
>>54373078
>implying age noncomformity is a mental illness

https://www.youtube.com/watch?v=kjC3zBKgL3M
>>
>>54373137
What the fuck.
Does that shit even compile?
What the fuck is const T(&)[N]? A reference to a const function that take an array of size N?
>>
>>54373157
It's not. Regression is a perfectly normal defense mechanism and occurs naturally when it comes to things like achieving orgasm or being creative. It can, however, indicate an underlying mental health issue.
>>
File: wtf am i reading.jpg (170 KB, 400x400) Image search: [Google]
wtf am i reading.jpg
170 KB, 400x400
>>54373218
>Regression is a perfectly normal defense mechanism and occurs naturally when it comes to things like achieving orgasm or being creative.
kill yourself
>>
>>54372961
mtfg successfully averaged 2 ints in C a while back.
It seriously is a thing

I don't understand why. I think it's that you have to be a pretty fucking massive reject to want to spend your spare time with a computer for any other purpose than vidya games. Traps fit that mould nicely
>>
>>54373372
>mtfg successfully averaged 2 ints in C a while back.
it's fucking nothing
>>
>>54373053
What's wrong with .NET?
>>
>>54373372
and by successfully I mean with the full range of autistic bitwise operations
I think I saved it

int average(int a, int b)
{
int t = (a&b)+((a^b)>>1);
return t + (((unsigned)t>>31)&(a^b));
}
>>
File: ca.webm (3 MB, 1280x720) Image search: [Google]
ca.webm
3 MB, 1280x720
>>54372809
>>54372831
>>54372836
Please don't bully. Bullying others will not make your life better, /dpt/ is supposed to be a safe space for programming discussions.
>>
>>54373443
KILL YOURSELF STUPID FAG

>/dpt/ is supposed to be a safe space for programming discussions
FUCK OFF TO REDDIT FUCKING CANCER FAG
>>
>>54373425
nah nah nah look man
int t = (a&b)+((a^b)>>1);

look how fucking autistic that is
it's literally (a+b)/2
>>
>>54373457
kill yourself retard
>>
>>54373451
whats with all the goddamn spergs lately?
>>
I'm sure this gets asked every day but...

Which free course/path is best for learning web development out of Odin / Freecodecamp / Udacity?
>>
>>54373457
>it's literally (a+b)/2
What if 'a' and 'b' both equal INT_MAX?
>>
>>54373654
DON'T QUESTION HER INTELLIGENCE THIS IS A SAFE SPACE SHITLORD
>>
>>54373584
>>>/g/wdg
>>
>>54370219
I keep seeing this chick on the OP image occasionally who is she?
>>
>>54373840
>she
it's a forced fag meme
>>
>>54373856
Soooo she has a penis?
>>
>>54373877
it's a crossdressing fag guy with a cock and balls
>>
She is a he* can't you tell. Normys
>>
>>54373892
I fail to the problem here. What's this dudes name? I need to know
>>
>>54373902
google himegoto
>>
>>54373902
hime and the show is called himegoto or something now fuck off to /r/
>>
>>54373910
>>54373912
Thanks senpai
>>
>>54373916
Unless you're really into traps or Haskell, it's going to make you very uncomfortable.
>>
Daily reminder that HimeGoto is considered harmful
>>
>>54372985
I am.
>>
>>54374002
Not as harmful as C++.
>>
>>54371564
>program kernels
>learn C++
m8...
>>
File: 1462317814029.jpg (99 KB, 800x869) Image search: [Google]
1462317814029.jpg
99 KB, 800x869
is SICP translated to JavaScript already?
>>
>>54374188
yes.

https://nodejs.org/en/
>>
>>54373183
>I don't know how to read declarations
>>
>>54373431
>>54373457
that's wrong tho
>>
>>54374188
>is MEME translated to EvenShittierMeme already?
>>
>>54374188
https://www.comp.nus.edu.sg/~cs1101s/sicp/
>>
>>54374247
seems to work with the test cases i did

rounds toward zero which is the desired result
>>
>>54374302
>seems
ok
>>
>>54374323
>says it's wrong without any explanation
fuck off
>>
>>54374297
ty
>>
>>54374343
nice dubdubs
>>
File: opengl.png (6 KB, 640x508) Image search: [Google]
opengl.png
6 KB, 640x508
We've started learning OpenGL in our Computer Graphics course. Will Vulkan obsolete everything I will learn?
>>
>>54374384
No
>>
>>54374384
absolutely not
>>
>>54374336
>bases his conclusion on "seems"
>expects meaningful discussion
yeah, sure
>>
>>54374419
kill yourself retard, there is no reason to think it's wrong, i tried all the relevant cases and because of how the code is designed it should hold for all cases and platforms, you're the one that claimed it's wrong, the burden of proof is on you
>>
File: DLBS4D3.png (6 KB, 924x575) Image search: [Google]
DLBS4D3.png
6 KB, 924x575
Working on a small program in C++/Qt. It basically needs to display logs, messages and various stats from a game engine a friend of mine is creating.

Doing things slowly, it uses tcp to communicate with the game. I'm mostly having fun with Qt and its stylesheets.
>>
>>54374419
>>54374434
you only need to provide one (1) example of input that it produces the incorrect result

fucking retard
>>
>>54374449
>one (1)
>>>/x/
>>
>>54374434
>no reason to think it's wrong
unless you know c
>relevant cases
they're all relevant
>code is designed
without actually knowing c
>should
it doesn't tho
>>54374449
how would you check correctness if you don't know c?
>>
>>54374517
kill yourself idiot, YOU don't know C, if you knew C you would be able to point out something specific about the code that makes it wrong
>>
>>54374384
Vulkan was once called Next Generation OpenGL or just GLnext.
>>
Shouldnt /dpt/ have its irc? Installgentoo is full of idiots.
>>
>>54374384
Why did you make it violet?
>>
>>54374533
here's 2 things that make it wrong:
>a&b
>a^b
>>
>>54373118
is this windows? Just use visual studio and install GLFW via nuget
>>
>>54374384
>Will Vulkan obsolete everything I will learn?
Vulkan = DOA
>>
Has anybody here tried to use GPU acceleration for calculate heavy tasks?
>>
>>54374666
You spelled "DX12" wrong.
>>
File: mfffmfm.png (1010 KB, 2000x2210) Image search: [Google]
mfffmfm.png
1010 KB, 2000x2210
I came to a /dpt/ yesterday to ask a couple of questions and found that there's no information at OPs post, like in other threads, as /flt/.
As I know nothing, I barely can contribute. I'll post a couple of infographics I have if they somehow help.
>>
>>54374640
It's linux, I'm trying to cross-compile.
>>
How do you know what parts of the program to separate into files?
I have a "graphics.hpp" that handles graphics, but my main engine file handles all kinds of shit, weapon classes, collision triggers, explosions, AI logic, physics.
Should I just make them into "weapons.hpp", "physics.hpp", "AI.hpp"? I heard seperating a project into multiple files is inefficient.
>>
>>54374683
Altcoin mining.
Didn't program it though.

It was pretty tedious 5y ago, don't know if the new API got any better.

Minefield of gotchas, tho. What do you want to speedup? There are only limited domains of problems that benefit from GPUs, you need to be able to reduce it to matrix calculations/linear algebra.
>>
>>54374762
What information would be relevant to the OP?

Beginner languages?
Best languages?
Good resources?

No one can agree on any of this.
>>
>>54374768
maybe try including the lib path directly and see what happens
>>
>>54374683
Of course faggot
Its not effective
>>
>>54374577
not a problem on any relevant compiler

cast to unsigned and back if you're going to be this pedantic
>>
>>54374795
You can start literally anywhere. I started with JS and Perl, probably the worst possible way to start, but I'm working in C++ pretty much daily now.

K&R should be your guide to pass your noob phase.
>>
>>54372985
I don't want to throw errors every second line of code.
>>
Off topic, but still semi related. Does anyone here use a Sceptre U435CV-U as their monitor? Lag isn't a big issue for me, I don't gayman on my desktop. But text is very important because all I do is programming and shit post. I would like to get on the 4k productivity level.
>>
File: 1440084677790.png (1 MB, 1600x1236) Image search: [Google]
1440084677790.png
1 MB, 1600x1236
>>54374795
I see, so the problem is that there is no agreement betwen programmers?
well, at least there could be a little something so people could read before posting. I know nothing about languages but I heard that python is easier than other languages, that is something.
>>
>>54374863
>>>/g/sqt
>>
>>54374863
>Sceptre
sounds cheap and shitty

lag should be fine since it probably doesn't have fancy processing gimmicks

the main concern should be if it's IPS and high quality (like no uneven backlight and clouding and shit) and also the stand which is presumably the most basic shit with just tilt forward/backward

count on having a few dead/stuck pixels
>>
>>54374779
There's no exact science to it.
Just group together things which makes logical sense.
There are various tradeoffs between readability, needing to include too many headers, splitting code up to much, etc vs extra compilation/preprocessing times, but they are very minor tradeoffs at the end of the day (unless you have millions of lines of code), so don't fret too much over those things and focus on logical and semantic structure of the code.
>>
>>54374762
>Google
>Facebook
>Python
That infographic is very outdated and written by a Python shill.
>>
>>54374847
what is K&R?

>>54374938
It could be. I can't discuss.
>>
>>54374781
Going to be working with big numbers, 100million digits and will be calculating them in all sorts of ways.

>>54374837
(You)
>>
>>54374887
Yes, but learning Python first can inhibit your ability to learn other languages, especially C-like languages like C#, C++ and Java.

Your learning language should likely match the industry or particular applications you wish to pursue.

For example, you would likely use C in embedded systems and kernel development, but you wouldn't do the back-end of a website or most enterprise applications in C.

If you want to learn to make mobile apps, you would probably be better off jumping right into Java or C#, as both of these can work on Android or iOS.

The good thing is that most of the Big 10 can be widely used across many platforms, and your language of choice will end up being your own personal preference. While some languages have strengths in particular industries and applications, most (high-level) languages can be used for just about anything.
>>
>>54374959
>K&R
It's "the C programming language" book.
If you can't google shit you won't last long in programming.
>>
>>54374891
If I wanted an answer about muh input lag on battlefield 12 then I would have asked there.

>>54374901
From what I've seen on reviews, the backlight is even. The panel is an lg RGBW IPS. Just wondering if anyone here writes any code on one.
>>
>>54374984
So, you are telling me there are different "tiers" for languages?
>>54375003
I asked you because K&R is pretty inespecific, but you are right, just googled it and it was like the second or third link.
>>
File: Booru-chan.png (1007 KB, 1092x698) Image search: [Google]
Booru-chan.png
1007 KB, 1092x698
Working on tag completion suggestions for my Booru browser
>>
>>54374843
>I don't know c
as established before
>>
How do you become himegoto
>>
>>54375082
Where's the hardcoded dick sucking button?
>>
>>54375046
Not him, but think of programming languages as tools in a toolbox; you're not gonna use a screwdriver to unclog a sink.
>>
>>54375082
cool design, what are you using?
>>
>>54375082
can it bulk download?
>>
>>54375137
Swift
>>
>>54375145
You can select multiple posts and then save them all at once
>>
>>54374795
>Beginner languages?
If you're using windows, i'd say VB.net

>Best languages?
Depends on what you want to do.

>Good resources?
Depends on the language.

>No one can agree on any of this.
That's because they're all relative to the individual.
There is no "best" language.
>>
>>54375132
I see, so as the tools there are more specific languages than others, some of them are more versatile.
>>
>>54375171
neat, have you thought of adding suggestions? like the more you download images with curtain tags, it starts to recommend those or put them higher on the list of search results.
Would be nice if it knew which you already downloaded so you don't see those again
>>
>>54375188
nope, running linux. but what >>54375132 said was useful, if you think of languages as tools, the better tools will depend on the work you must do. and depending on the work you want to do you will need more specific tools (languages). So a surgeon and a plumber will have their respective tools, but they are not barely related.
>>
>>54375214
Well it has a tag history, so if you search a tag once it gets put at the top of the suggestions. Honestly I don't see the point in hiding posts that you've already downloaded, though maybe there could be an indicator that you've already downloaded it
>>
File: 1451337320315.jpg (25 KB, 400x386) Image search: [Google]
1451337320315.jpg
25 KB, 400x386
>post abrasive comment on my stock broker's blog about a fucktarded, unfair, exploitable new feature
>they reply back, they accuse me of having misunderstood
>i stand my ground, explain how i think it works and ask if it's wrong
>(the broker?) starts typing for a while, and then gives up
fucking BTFO

>a bit later someone posts a question in reply to me asking me to explain
>i type up a reply and then "The post you're trying to reply to has been removed by a moderator." (their question got removed but not my posts)
lol wut

i guess i will wait a while and then probably end up actually doing it since it's well within their rules and not illegal or anything, it's just a bigger discount and more lost revenue for them than in the average case
>>
>>54371280
The whole software industry is held back because of people like you. Please don't ever reproduce and, if possible, kill yourself with fire.
This said: the recursion is the loop as it is mathematically defined, and it is a lot more flexible then the iteration. It avoids so much retarded bugs it probably could save a lot of companies. Also, a compiler/platform that is not written using a pen in the programmer's ass optimizes this (including TCO). Yes, I'm looking at you, JVM. Scala had to implement it in its compiler, while Clojure had to write a function to cope with the oracle's devs retardedness.
Yes, I'm mad.
>>
>>54375245
if you hide them, they won't take space and time to scroll through, you could alternatively put them in the bottom or as you said, just place an indicator that you've downloaded them
>>
>>54375266
>a lot more flexible then the iteration
bwahahahahahaha
>>
>>54375266
iteration can do anything that recursive function calls can do and recursion is literally deadly
>>
>>54375281
Good point, ill probably make it a preference later on
>>
>>54375311
but this may be optimized! Look at SBCL, Haskell, Scala... They do not eat as much stack as C recursive calls do, and they make heavy use of it. It's 2016, we have TCO
>>
>>54375419
>Look at Meme, Meme, Meme...
Thread replies: 255
Thread images: 25

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.