[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 / qst / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vip /vp / vr / w / wg / wsg / wsr / x / y ] [Search | Home]
4Archive logo
/dpt/ - Daily Programming Thread
If images are not shown try to refresh the page. If you like this website, please disable any AdBlock software!

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

Thread replies: 314
Thread images: 31
What are you working on /g/?

>Developers of D are continuing to work on being able to interface with C++
>Andrei continues his goal of being able to use the standard library without GC
>LDC coming to Android
http://arsdnet.net/this-week-in-d/2016-jan-24.html

>C# gains new features such as non-nullable reference types, local functions and immutable types
https://www.kenneth-truyers.net/2016/01/25/new-features-in-c-sharp-7-part-2/

Remember to use this website for rolling for projects!
https://better-dpt-roll.github.io
>>
Having an issue that I know is a simple fix I just can't see it. Dealing with pipes between parent and child processes and whenever I print the final result I'm getting an extra newline when I print the final result with a newline, and no newline when I don't. Here's the code, feel free to tell me if I did anything else wrong.

http://pastebin.com/UX51d3zC
>>
>>52622420
Please use an anime image next time
>>
>>52622420
>news in OP
good lad
>>
>>52622464
Thanks, I thought it'd be nice if we started posting programming-related news pieces in the OP
>>
Is it worth implementing a 2d vector library using SIMD?
>>
>>52622511
maybe if it will operate on many vectors at once
>>
File: vaccine.png (1 MB, 2302x1504) Image search: [iqdb] [SauceNao] [Google]
vaccine.png
1 MB, 2302x1504
git rebase master
>>
>>52622511
no
>>
i fell for the linux meme

what do i do now?
>>
>>52622461
Imagine if you go looking through amazon for a DVD of the Green Mile.
You're not sure about the language options and you're getting it for a non-native English speaker.
They can read English perfectly well, but might struggle with the thick southern accents so you just wanna make sure it has English subs just in case.

You ask on the item page in the comments about what subtitles are available because the product page doesn't mention.

>Just buy the book
>Why don't you buy the book, it's in English?
>The book is far superior compared to the movie, just get the book instead
>Amazon is a fucking bookstore, why are you looking for movies?

/a/ posters in a nutshell.
>>
>>52622984
You install a proper desktop environment like Unity.
>>
>>52622459
This is the output I'm getting
$ ./main Hello
hELLO, wORLD
Hello, World
$

Where's the extra newline?

I don't understand what you're doing. You have two arrays ("ptoc" and "ctop") but you only initialise one. You also have code after the parent child if. Won't both try to execute it? But it seems to be meant for the parent only. I'm not familiar with pipe so maybe that's why, but I don't think that's right.
>>
M$ just open-sourced their machine learning framework: https://github.com/Microsoft/CNTK
Where were you when F# won the functional language bowl?
>>
>>52622459
>>52623036
Oops, ignore the argument to main, I was trying pass the argument through the pipe, but it broke everything. That output is from your unmodified code though.
>>
>>52622677
>>52622956

Okay, asking since I've started working on a 2D phyiscs library and then I have an idea for a small 2D game I'll make just for learning purposes. But that begs the question, is a 4d Vector the only one worth SIMDizing or would it be worth it for a 3D one if you add a padding?
>>
>>52622984
install emacs and go make something
>>
>>52622954
oh my.
>>
>>52622984
gcc g++ python cmake and be free
>>
File: sigh.png (4 MB, 3200x1800) Image search: [iqdb] [SauceNao] [Google]
sigh.png
4 MB, 3200x1800
>>52623135
>>
>>52623113
i wouldn't bother with SIMD at all unless you're a very advanced programmer and you're working on something that could really benefit from a slight boost in performance.
>>
>>52622511
https://github.com/ebassi/graphene
>>
>>52623291
Even then there are tons of extremely optimized and extremely well-tested libraries that a single man in their basement couldn't possibly hope to match, let alone surpass, so there's no point.
>>
>>52623361
>a single man in their basement couldn't possibly hope to match, let alone surpass, so there's no point.

Damn if that ain't the story of life. Time to drink another beer.
>>
>>52623361
That is true, but I like I said, I'm just doing this for learning purposes. It's not like I'm actually trying to outdo any of these libraries
>>
>>52623460
still, for learning purposes i think you should focus on more conventional things first and foremost because SIMD is kinda shitty
>>
Should i read sicp before learning C?
>>
>>52623460
For learning purposes, a GPU-accelerated tensor library is a lot more interesting, impressive, and useful. You can, in fact, alone in your basement, make a new such library that's better than the competition's because of the wide variety of optimizations and code generation techniques that can be tried.
>>
>>52623558
Absolutely.
>>
>>52623558

It won't help you to become a better C programmer. Go ahead and read it for pleasure if you want though.
>>
>>52623595
>It won't help you to become a better C programmer.
Spoken like someone who truly never even tried to read SICP!
>>
>>52623609
but it won't help you to become a better C programmer. Go ahead and read it for pleasure if you want though.
>>
What's the best language to learn scripting in? I know c++ and want to learn how this shit works
>>
>>52623609
It'll help you become a better programmer
Not a better C programmer
>>
>>52623595
>>52623624
Then what will SICP make me better at?
>>
made a bot crawler for a forum to parse redirect links and feed me back the real file host links. works gud.

i would post it but i'd get banned
>>
>>52623558
Absolutely! At a minimum, there are some great video lectures on youtube as well.
DrRacket is a good IDE to use to work through the examples.
>>
>>52623627
>scripting
Define "scripting", what platform you'll be working on and what your going to be scripting.
>>
>>52622420
Reposting from the Ruby thread.

Hey, /g/. New to the board.

I went to school for IT back in 2009-2012, couldn't get a job with it, and retained nothing. Looking to brush up with the hopes of getting in somewhere as a generic code monkey, or do freelance work until I get a portfolio built up. I retain a little Java, but I was wondering where would be the best (read: most lucrative) place to start language-wise?
>>
>>52622420
Don't start putting links in the OP.

It's a slippery slope.
>>
A book which teaches Scheme and functional programming paradigms cannot be expected to be particularly useful for someone trying to learn a systems language, which is not typically programmed in the same ways as Scheme.
>>
>>52623796
How the fuck do you sit through lectures for 3.5 consecutive years and retain nothing?
>>
>>52623796
Depending on where you live like 80% of all programming jobs are C# or Java, choose one.
>>
>>52623822
No job = no practice = no retention.

>>52623823
Iowa, so Java will be easiest to resume I suppose. Thank you very much.
>>
>>52623822
Just because you went to class doesn't mean you learned anything.
>>
>>52623822
Extremely easily? you realize that after completing a undergraduate degree you know next to nothing about your subject right?
>>
File: 1447281550957.png (285 KB, 471x466) Image search: [iqdb] [SauceNao] [Google]
1447281550957.png
285 KB, 471x466
For someone with almost zero prior exposure to programming, is the following a logical learning progression

>Ruby to Python to Java to C++
for someone with an interest in game development and freelance oddjobs?
>>
>>52623806
Almost every general on every board has pastebin, resources and on-topic articles in the OP
>>
thinking of designing and building a basic circuit and software to interface PIC chips with USB.

It would be pretty basic but I think there'd be a lot of really low budget projects that could use it especially for control circuits.

DO you think this is a good idea, dpt?
>>
>>52623921
>he studied a worthless degree
>he didn't study on his own time
>he has no motivation to think about his subject outside of class

i am literally lmaoing at your life

>>52623935
C > C++/Java > Python/Java
>>
>>52623935
>freelance oddjobs
PHP

>game development
C#/C++
>>
>>52623981
Is C not made obsolete by C++, or are you suggesting it purely as a stepping stone?
>>
Find a flaw.
int to_digit(const char c)
{
return (int) c - '0';
}
>>
>>52623646

SICP will probably make you a better Scheme programmer, and perhaps also a better programmer in general... at least when it comes to abstractions.

Systems programming is a different ball game though. A good systems programmer must be able to think both about higher level constructs (to make larger programs easier to maintain) and also lower level constructs (to make them not run like dogshit despite not needing an interpreter/VM).

C is a systems programming language, and is used for tasks where performance is of upmost importance. Many practices common in Schem may not be the best choices for a C programmer.
>>
>>52624039
to_digit('a');
>>
>>52624039
No colon after variable definition.
>>
>>52624025
C is it's own programming language.
C++ adds a bunch of things and it's own way of doing things that look absolutely nothing like idomatic C.

I recommend C because it's a small language with very few abstractions that get in the way of learning the basics of programming.
It also helps you to appreciate the massive featureset of modern languages even more because C has almost none of them.
>>
>>52623935
MY SIDES
>>
>>52624068
Scheme is a simple language with few abstractions that doesn't get in the way of learning.
C is "how to learn nothing in 20 hours of debugging": the language.
>>
>>52624087
>C is "how to learn nothing in 20 hours of debugging": the language.

In 20 hours of C, you'll learn how sweet real strings are.
>>
>>52623935
literally laughed out loud

>python -> C -> Java -> C++
or if you have a brain
>C -> Java -> Python -> C++
>>
When should I use structures instead of classes in C++?
>>
Working on poor man's TCP for my MMO.

I realized that implementing reliable and in order at the same time would require a bit of refactoring, but then I also couldn't think of a situation in which I would need both at the same time, so for now I'm going for only one or the other at a time.

Screenshot from a while ago
>>
>>52624049
Will reading SICP as my first programming book hurt me in the long run?
>>
>>52623958
And /dpt/ is not going to be one of those generals.
>>
>>52624118
Or, if you're not clinically retarded,
>scheme -> OCaml
>>
>>52622420
>>Andrei continues his goal of being able to use the standard library without GC
lmfao this should already have been the case
>>
File: rect.png (74 KB, 754x614) Image search: [iqdb] [SauceNao] [Google]
rect.png
74 KB, 754x614
>>52624127

Wew

>>52624119

For C-related backwards compatibility and POD.
>>
>>52624119
Same shit in C++.
>>
>>52622420
>>C# gains new features such as non-nullable reference types, local functions and immutable types
more pointless "features"
>>
>>52623958
fuck off
/dpt/ isn't one of your consumerism generals that spams links to buy things in the OP.
In here, we spam traps and umaru.
>>
>>52623935
java -> C++

and THEN maybe python if you want to do low-quality freelance oddjobs. absolutely don't start with python with ruby
>>
>>52624057

I am not sure what language you are thinking this is, but we do not do that in C.

>>52624068

These are the reasons why I recommend C over C++ to beginners. That and not wanting to have to have to explain what the fuck cout is, because that involves also explaining what an object is, what a method is, and what operator overloading is. It's much easier to explain printf. It's a function, and it looks like a function call just from the syntax.
>>
>>52624188
Well, better late than never
>>52623806
>>52624173
>not wanting to know what's going on in the programming world
>>
>>52624206

Sort of. The more interesting features are the record types and pattern matching that were discussed in part one of the C# 7 news.
>>
File: part2_128.png (8 KB, 128x128) Image search: [iqdb] [SauceNao] [Google]
part2_128.png
8 KB, 128x128
>>52624197
almost shat myself laughing

procedurally generated robots are my plan for February. The placeholders will have to do for now.
>>
>>52624263
The programming world moves very slowly.
If a new language comes out tomorrow and everyone decides to back it, it will take at least 5 years before it's in a state in which you could recommend it to people.
>>
>>52624283

What's it done in?
>>
>>52624218
There is no "we", it's just you.
>>
>>52624302
plain C# for the server
C# and Unity for the client
>>
>>52624300
No, you don't understand, everybody will be writing everything in Rust by the end of next week, HN told me so.
>>
>>52624320
I puked.
>>
>>52624320

Nice. C# is goat.
>>
>>52624332
this

have fun being stuck with that crayon shader unless you cough up some more money for the jew
>>
>>52624333
>tripfag approved
Confirmed for garbage.
>>
>>52624349
You can write custom shaders in Unity
>>52624332
I've implemented graphics engines in DirectX and OpenGL, and don't care to again

>>52624333
Damn right
>>
>>52624349
If only that was the only issue. The ridiculously low performance and high resources usage is the main issue really. No matter how low-tech you make your game, people need $1000 machines to get more than 20 FPS.
>>
>>52624349
>have fun being stuck with that crayon shader unless you cough up some more money for the jew

Unity pricing changes fucking ages ago m8
>>
>>52624371
>You can write custom shaders in Unity
You aren't free to use whatever shader you want unless you buy it.
>>
Any traps want to be my gf?
>>
>>52624391
see
>>52624380
>>
File: 1452678625898.gif (131 KB, 600x338) Image search: [iqdb] [SauceNao] [Google]
1452678625898.gif
131 KB, 600x338
I've spent the last 3 weeks learning to program and I haven't done anything else.

What anime should I watch?
>>
>>52624371
>>52624380
ok i guess you can have custom shaders without any special license, must have been outdated info. most unity games still look like ass though

>>52624378
this. unity is so shit in so many ways. just because it's a game engine doesn't mean you should use it. especially for 2d games you don't really gain anything at all as a developer
>>
>>52624417
Developers use Unity because it brings development time and costs to sane levels compared to engines like Unreal and cry.
>>
>>52624411
Spice and Wolf.
>>
>>52624459
agdg kids use unity because they're too afraid and too lazy to learn how to program for real
>>
>>52624463
I just started watching that with my boyfriend. Spooky.
>>
>>52623115
I installed emacs a few months ago but now all I do is work on my emacs config. Fucking emacs.
>>
>>52624476
Or to use a non-shit engine anyway.
>>
Give this code in C++:
A a = new A();
delete a;
a = new A();


What's being called on the third line? The normal constructor or copy constructor?
Also, I have read about the rule of three in C++, but should I bother with copy constructor, etc if I don't plan on using the object in any way that would require it?
>>
>>52624459
Cry and unreal have lesser royalties and perform a fuckload better. That's called "bringing the development time and costs to sane levels". Devs all tried unity once and only the incompetent (mostly indie) retards stuck with it.
>>
>>52624578
Both.
>>
>>52624580
>unreal

Enjoy your 400mb binary for rendering a triangle.
>>
>>52624580
>perform a fuckload better
>bringing down development time
Shitfirstyearcsstudentssay.jpg
>>
>>52624616
Lrn2compact, noob. And nobody cares about a 400mb that renders a triangle because videogames aren't simply the rendering of a triangle.
>>
>>52624629
Found the paid unity shill.
>>
>>52624637
>missing the point

A binary that size for a simple 2D game is absurd.
>>
>>52624648
how did you found me?
>>
>>52624702
There's no reason to use a 3d game engine for a 2d game.
>>
As a filthy wretch that only knows JavaScript, what are classes?

I know they're not in JS, but I'm reading about closures and the author mentions them as an explanatory aside aimed at users coming from other languages.
>>
Alright, a bit of a strange question here
I wanted to know, when it comes to constructors (or things in general, including return types), when variables are set are they an alias of the previous variable, or are they just set to what that variable was at that time?

Take the following code.

public class StupidShittery {

int foo = 4;

void main() {
int integer = 4;
Foo(integer);
integer = 5;
}

public int Foo(int integer)
{
this.foo = integer;
return integer;
}

}



Would foo's value change after integer's value is changed, or would it stay at 4? Someone was trying to convince me otherwise. If this isn't true, does anyone know what they might have been trying to say? I'm not sure of anything that reflects the changes of variables live unless the variables themselves are static.
>>
>>52624760
That's irrelevant since Unreal is marketed as having 2D support. Also, I hope you realise most 2D game engines are just OpenGL/DirectX with an orthographic projection.
>>
So if I'm reading this documentation correctly
 public synchronized void createNewThing()
{
}

will NEVER run concurrently with another of the same type, even if they're called at the exact same time, yes?
>>
>>52624840
Use of opengl != 3D. Support for 2D != optimal for 2D. After all, unity is marketed as a game engine.
>>
>>52624767
>I know they're not in JS
Yes they are.

https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Classes
>>
>>52624840
>most 2D game engines are just OpenGL/DirectX with an orthographic projection
so there is not much of a reason whatsoever to use any game engine but your own for a 2d game
>>
 p = np 
>>
>>52624888
p = p/n
>>
>>52624888
 false
>>
>>52624854
>https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Classes

>ES6
Shiny new toys

I've heard a lot of talk about how these classes are not "true" classes and are only going to make shit a nightmare in actuality.

What is a class?
>>
>>52624903
>>52624904
trips don't lie niggas
>>
How long to learn C++'s nuances and subtleties well enough to work in UE4?
>>
>>52624935
>How long to learn C++'s nuances and subtleties

Several human lifetimes.
>>
File: Capture.png (89 KB, 958x848) Image search: [iqdb] [SauceNao] [Google]
Capture.png
89 KB, 958x848
don't do this
>>
>>52624913
>In object-oriented programming, a class is an extensible program-code-template for creating objects, providing initial values for state (member variables) and implementations of behavior (member functions or methods).
>>
>>52624794
foo will be changed because the method has access to it.

What they probably meant to say is that you can't modify the value of a parameter passed to the method if the method doesn't already have access.
This is because primitives are passed by value, not by reference.

You'd need an example with multiple classes to show this.

Also, your constructor should have the same name as your class i.e. StupidShittery.
As far as I know, you cannot return from a constructor, since you are already returning the newly created object itself.
>>
>>52624956
OO is much maligned, from what little I've read. Is there much merit to that kind of viewpoint? What are the pros of OO-programming?
>>
>>52622459
I think your final call to read is reading the newline as part of the string, so that when it calls the last printf, there are two newlines -- one that was read with the string, and one that you included in the printf call. See:

mini$ ./a.out
hELLO, wORLD
0123456789012345678901234
0123456789012345678901234
mini$
mini$ ./a.out
hELLO, wORLD
012345678901234567890123
012345678901234567890123

mini$
>>
>>52624996
It maps easily to many real-world concepts
>>
>>52624996
>OO is much maligned, from what little I've read.

on /g/, by memers.
>>
File: 8AubEEl.png (3 KB, 749x75) Image search: [iqdb] [SauceNao] [Google]
8AubEEl.png
3 KB, 749x75
wew

Not that many, but I still haven't learned to commit after every change that doesn't break the build.
>>
>>52624968
Sorry, that code was a bit disgusting because it was just pseudocode; here's a better example

public class StupidShittery {

int foo = 4;

public StupidShittery() {
int integer = 4;
Foo(integer);
integer = 5;
}

public int Foo(int integer)
{
this.foo = integer;
return foo;
}

}

So foo would end up being 5, even though Foo would return 4 because int foo isn't private?
>>
File: YcA0uC1.png (2 KB, 32x701) Image search: [iqdb] [SauceNao] [Google]
YcA0uC1.png
2 KB, 32x701
>>52625090
wew pt. 2
>>
>>52624578
Normal constructor is called in both cases. But the type of a should be A* not A. Also your syntax on the first line is weird, you don't need the empty parens.
>>
struct foo {
char * const bar;
};

int main(void)
{
struct foo *x = malloc(sizeof (struct foo));

x->bar /* how to assign? */
}
>>
Anyone got tips/recommendations for vb.net+sql?

I have to learn that shit for the job. Looked at it a bit and it reminded me that I am not very smart.
>>
Hi /g/, I've been trying to learn C++ by working through "Accelerated C++ practical programming by example" and I'm having a bit of trouble.

In section 3.2.2 it stores the length of a vector called "homework" in a variable called "size" using the code:
typedef vector<double>::size_type vec_sz; 
vec_sz size = homework.size();


When I try to compile the code after adding this it returns the error:
>'vector' does not name a type
>typedef vector<double>::size_type vec_sz;

I am using Notepad++ and the Mingw-w64 compiler, which has been working so far. Any idea what could be causing this?
>>
>>52625212
All you have inside of struct foo is a pointer that can't be changed (because it's const). Normally malloc will give you back memory at some random location, but since your pointer can't be changed, you can't set it to the location returned by malloc. So unless you can find some way to force allocation to happen at a specific address (i.e. your const pointer), it's pretty useless.
>>
>>52625298
either add
using namespace std;
in your file or use
std::vector
>>
>>52625298
Looks like it should work, maybe the mingw compiler is very old? Works for me with VC2010. Maybe you could try just:
vector<double>::size_type size = homework.size();

and see if that works.
>>
>>52625365
Thank you, it worked.

I had using std::vector, but I guess I must have deleted it.

Thanks again.
>>
>>52625212

Does it need to be on the heap?
>>
>>52625504
I put ur mom on the heap ;)
>>
>>52625556

In any case, there's a trick to it (which I was not aware of).

Memcpy'll do it.
>>
i got a 6 figure job a month ago but it's shit.

our main app is a "c# web app", but it's actually:

-javascript
-stored procedures

literally everything is one of those two. the most SIMPLE select in the world is done via a stored procedure (select x from y where [email protected]), c# calls it and passes it to the view or javascript.

the C# does nothing but call stored procedures (they're scared of C#)

the javascript is the worst in the world, it's jquery with no other organization, not even javascript objects. it takes up pages and pages of shit with global variables, and huge swathes of it are copy and pasted across different html views.

i know so much more, and how to do everything better, but i don't know how receptive they will be.

should i stay for the money or just find another job even if it pays less?
>>
>>52625667

Take them out for a nice date, and then fuck them hard with ASP.NET. They'll learn to love it.
>>
>>52625667
This sounds interesting actually. How many different stored procedures are there?
>>
>>52625152
nice m8. what are you working on?
>>
File: dfdisk_delpart.png (5 KB, 640x300) Image search: [iqdb] [SauceNao] [Google]
dfdisk_delpart.png
5 KB, 640x300
It's coming along kind of nicely now.
>>
>>52625880
500
>>
>>52625900
https://github.com/rzumer/Webbum
>>
>>52625667
most software is shit just stay for the money and don't antagonize them too much with your own ideas
>>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

int count_words(char* line){
char *w_token;
int words = 0;

w_token = strtok(line, " ");

while(w_token != NULL && w_token[0] != '\n'){
words++;
w_token = strtok(NULL, " ");
}

printf("%d\n", words);

return words;
}

int main(int argc, char *argv[]){
FILE *f;
char file_name[80];
int words, lines;

printf("Input a file name: \n");
scanf("%s", file_name);

f = fopen(file_name, "r");
if(f == NULL){
printf("Error opening file\n");
return 1;
}

words = lines = 0;

while (1) {
char buffer[80];
lines++;

fgets(buffer, 80, f);

words += count_words(buffer);

if (feof(f))
break;
}

printf("%d words and %d lines total\n", words, lines);

fclose(f);

return 0;
}


this program works well to count the number of words and lines in a file except for the one case where only the last line is empty. In this case for some reason it counts an extra word. If there are more than one empty lines at the end it won't count any extra words and will work correctly. It also doesn't count empty lines that are not a single line at the end of the file as words.

why
>>
>>52626112
I know, I have 9 years of experience, this is a whole new level of shit for me though.
>>
>>52626016
holy shit
>>
>>52622420
>Andrei continues his goal of being able to use the standard library without GC
EXCELLENT
>>
>>52625105
Whaaaaat
No, foo will be set to integer, which is 4, so it stays the same. Why do you think it would be 5?
>>
>>52624578
> Give this code in C++:
That won't compile; the value returned from new is a A*, not A.
> What's being called on the third line? The normal constructor or copy constructor?
You don't get that far, because your code won't compile. If you fix the type, it's the normal constructor. There's no copy being made (you're copying a pointer, and pointers don't have constructors).

> should I bother with copy constructor, etc if I don't plan on using the object in any way that would require it?
If the default implementation won't work, either implement it, "delete" it (C++11), or make it private. Don't rely upon it not being called.
>>
>>52625105
foo = 4 because pass by value, not pass by reference
>>
wtf is going on here? I rebased the program and it still won't work.
>>
>>52626358
Why are you using XP
>>
>>52626374
because it's a VM and it runs fast
>>
>>52625667
The JS part sucks, but using stored procedures for everything is a perfectly reasonable approach. It's certainly better than letting back-end web code execute raw queries.
>>
How do I write a C++ for loop in C?
I'm trying to convert one of my programs to C, but I never learned the language
for (int count = 0; count < size; count++)
cout << array[count] << " ";
cout << endl;
>>
>>52626429
        {

}
>>
>>52626429
use printf();
>>
>>52626429
you should be using printf and \n
>>
>>52626445
printf("array[count] ");
would this print the space as well?
>>
What are my nimfriends up to?
>>
>>52626389
Then go catch it!
>>
>>52626494
yeah. just add \n to the end for a newline.

printf("array[count] \n");
>>
>>52626494
of course
>>
>>52626494
shiggy doodely
>>
>>52626514
it's better than window 8

I don't have a key for W7 so I'm stuck with XP. I really haven't had any problems with it and I run a shit load of hardware and software analysis programs on it.
>>
>>52626551
>I don't have a key for W7
daz loader my nigga
>>
>>52626551
Install Gentoo
>>
>>52626538
>>52626532
>>52626531
thank you
>>
>>52626163
debug my code /g/
>>
>>52626572
probably will in the future but I'm satisfied with the setup right now. Even Pspice works on it ffs lol.
>>
>>52626494
>>52626600

Err, might want something like

printf("%d \n", array[count]);


Or whatever format specifier would be applicable to your situation.
>>
>>52626600
>>52626659
this is the correct thing right
>>
Starting with Heap h, I want to perform a level order traversal, save it in the string dynArray, then return it. But my program keep crashing.
...help?
struct Heap {
string name;
Heap *left = nullptr;
Heap *right = nullptr;
};

The declaration of the function is: */
string *printLinear(Heap h);

string *printLinear(Heap h) {

Heap *root;
// Base Case
if (root == nullptr) return dynArray;

// Create an empty queue for level order tarversal
queue<Heap*> q;

// Enqueue Root and initialize height
q.push(root);

while (1)
{
// nodeCount (queue size) indicates number of nodes
// at current lelvel.
int nodeCount = q.size();

if (nodeCount == 0)
break;

// Dequeue all nodes of current level and Enqueue all
// nodes of next level
while (nodeCount > 0)
{
Heap *node = q.front();

cout << node->name << " ";

q.pop();

if (node->left != nullptr){
q.push(node->left);
}

if (node->right != nullptr){
q.push(node->right);
}

nodeCount--;
}
cout << endl;
}
return dynArray; //I have yet to initalize the heap into an array based on level order transversal
>>
What's wrong with this js function?
function byTagName(node, tagName) {
var found = [];
tagName = tagName.toUpperCase();
if(node.nodeName==tagName){
found.push(node);
}
for (var i = 0; i < node.childNodes.length; i++) {
var child = node.childNodes[i];
if (child.nodeType == document.ELEMENT_NODE) {
found.concat(byTagName(child,tagName));
}
}
return found;
}
>>
>Illinois State doesn't let me major in InfoSec and major or minor in CS
Feels bad man
>>
>>52626724
yes if you're printing ints
>>
File: 1452575695622.jpg (158 KB, 720x480) Image search: [iqdb] [SauceNao] [Google]
1452575695622.jpg
158 KB, 720x480
>>52626767
>InfoSec
>>
>>52626806
fite me
ain't no hackers getting by me
>>
>working on porting and fixing some embedded code to another architecture at work
>the old developer is gone and the code he left behind is disgusting
>tons of "clever" hacks and magic numbers, with no documentation
>stumble on another hack he wrote today which saved 1 (one) byte of memory
>fix it to what it should have been
>2 previous bugs that have been around for 10 years are magically fixed

I get why you'd want to save on memory, but I don't understand why embedded developers feel the need to make everything hacky and sketchy.
>>
>>52622420

1. Search engine and NLP-based ranking system for a startup I work with.
2. External filesystem application (and interface) achieving access control through modern public key cryptography variants
3. Implementation of a recursive divide-and-conquer heuristic for approximating maximum clique search in arbitrary graphs
4. Personality-trained conversational agent using deep, sequential recursive neural network chains
5. Example implementation of a generalized semi-self-supervised neural network architecture capable of differentiating to function in multiple domains


Needless to say, I'm becoming stretched a little thin.
>>
>>52626806
What's wrong with infosec
>>
>>52626163
>>52626601
The line with "break" starts with a tab and then a space, the tab is being counted as a word because of how you wrote count_words.

For the lines, you're getting a bad count because of where you're checking for eof. Try it like this:

   while (1) {
char buffer[80];

fgets(buffer, 80, f);
if (feof(f))
break;

lines++;
words += count_words(buffer);
}


mini$ echo test.c |./a.out 
Input a file name:
108 words and 55 lines total
mini$ wc -w -l test.c
55 108 test.c
mini$
>>
>>52626924
>infosec
to understand security you need to have a deep understanding of mathematical encryption, good luck not knowing anything in the future
>>
File: 1445041315032.jpg (253 KB, 2048x1447) Image search: [iqdb] [SauceNao] [Google]
1445041315032.jpg
253 KB, 2048x1447
>>52625667
>6 figure job
>code isn't to your liking
>actually considering quitting because of this
>>
>>52627040
uh.... i have a lot of experience and good programmers are hard to find. it's not like i couldn't find another one
>>
>>52627016
There are many facets to information security beyond encryption.
>>
>>52627059
If the main application is in shitty c# I'm pretty sure a university student intern would do just as well
>>
>>52627061
Lol no there isn't
>>
>>52624051
This
>>
>>52627061
infosec is like 1 notch above web dev there is not much depth to the field
>>
>>52627070
the main app isn't in C#, c# is just the glue. it's all stored procedures (T-sql).
>>
>>52627116
What is the mightiest subfield of CS to go into then?
>>
posted this yesterday to /no reply/

is a career as a programmer possible without a degree? i'm learning web dev and ruby and much prefer the ruby work to the web dev.
>>
>>52625667
leave and give me the job instead
>>
>>52627138
Computer Engineering
>>
>>52627138
Chinese hacker, North Korean hacker, Russian Hacker > US Hacker > EU Hacker
>>
>>52626727
Assuming there's more code you haven't posted (i.e. I don't see dynArray declared anywhere). But this looks like a problem:
    Heap *root;
...
q.push(root);

Since you haven't initialized root, it could be pointing to anything. There's no actual Heap structure anywhere yet. So later on when you get this out of the queue and try to get name/left/right out of it, you're going into random memory locations.
>>
>>52627145
yes BUT you have to make things. Instead of having on your resume "graduated from X with Y degree", you need to have *legit* project links. Like, live links that take you to a page that you made that does something. It doesn't have to look nice. Hell, it can be some ascii-art game you made with javascript. Just showing that you actually made something, and that it works, and that it's live, is important. What I'd recommend is experimenting with making your own web server. This'll help you understand the many layers. Also the book Eloquent Javascript (google it) is available for free and is an amazing resource. I used to hate javascript, but after reading that I loved it.
>>
>>52623035
>proper desktop environment like Unity
>>
>>52627201
What does this mean? Can you give me an example project? I'm currently in my third year of undergrad and my major is described as "Computer Science and Engineering", but I don't really know what the difference is between the "computer science" part and the "computer engineering" part, and I don't know which category the code-monkeying I do falls into.
>>
>>52627217
awesome, thank you anon
>>
File: 1431320780444.jpg (91 KB, 759x514) Image search: [iqdb] [SauceNao] [Google]
1431320780444.jpg
91 KB, 759x514
>>52627263
NP and when I mention setting up your own web server, it's not all that complicated. To get you started, all you really need is an old laptop and the ability to google "how to set up my own custom web server".

Also, although you don't necessarily need a degree, textbooks are still really nice resources, as well as online courses. I'd recommend learning about the ins and outs of networking, as it fills in a lot of the grey area. I really enjoyed the textbook "Networking: A top down approach". Also, data structures and algorithms are important too. If anything on this [http://tsiege.github.io/blog/2014/05/02/tech-interview-cheat-sheet/] page doesn't look familiar, learn about it.

Godspeed my anonymous friend.
>>
>>52627234
Are you B.Sc, B.Eng, B.A

B.Eng > B.Sc = B.A
>>
>>52627234
Usually two separate majors. The engineering part has to do with building and programming hardware. Anywhere from microchips to whatever the fuck else as long as it's digital.
>>
File: shoot_in_foot01.jpg (17 KB, 600x262) Image search: [iqdb] [SauceNao] [Google]
shoot_in_foot01.jpg
17 KB, 600x262
>Concurrent programming
>>
>>52627317
>>52627319
The major are normally separate but my school (osu life) offers a combined major under the engineering department (so I'm B.Eng), even though the coursework is pretty much the same throughout all of these majors: [software dev, comp sci, comp sci & eng, comp eng, info tech]
>>
>>52627215
Bless you my good man, you have saved me. I can finally stop crying.
>>
Q: do government jobs stay away from technical interviews or no?
>>
File: 1393836743474.jpg (39 KB, 430x290) Image search: [iqdb] [SauceNao] [Google]
1393836743474.jpg
39 KB, 430x290
>>52627353
Also, anyone wanna recommend a good place to apply for a summer internship? I have an offer from cisco already, wondering if anyone knows of any more l33t places I could go to.
>>
If I theoretically were autistic enough to write a program in machine language, how would I run it?
>>
I need to compile/run simple c++ programs on android, assuming it's reasonably possible (cs lab requiring us to bring a laptop, I don't own a laptop).
>>
>>52627663
Termux, but it'll be a major pain in the ass
>>
>>52627663
get a cheapo laptop on craigslist
>>
>>52627670
Thanks. Going to try that out.

>>52627796
And that's definitely a fallback. I'd rather not if I don't have to though. I really don't have any other use for a laptop.
>>
>>52622420
I'm starting to not care about differences in languages that much as long as you have like static typing and some level of sanity and coherence

Whats more important is the free tools that the languages offer

I want UI toolkits, image and video processing, audio tools, statistical and numerical libraries, etc

And C++ is still the best language for that (even though a lot of its tools still kind of suck)

It feels like we have a new language every few weeks -- Rust, Swift, Nim, Crystal

Get back to me when you have a full featured set of tools for quickly creating applications without me having to roll my own libraries for everything from the ground up.
>>
>>52627663
There are C++ ides on Android, just look on the app store. I can't imagine a CS lab would require you to bring your own laptop though, your school seems like its shit.
>>
File: Untitled.png (70 KB, 1605x863) Image search: [iqdb] [SauceNao] [Google]
Untitled.png
70 KB, 1605x863
I'm using C++ to read a file line-by-line backwards.
So I use seekg(-1, file.end); where file.end is a streampos located at EOF, and file is an fstream.
I then do file.seekg(file.cur, -8), because the size of the line I want is exactly -8.
Then I do file.read(out, 8), where out is a char array of size 8.

And for some reason, char remain garbage data.
The fuck.
What am I doing wrong?
>>
>>52624119

Use structs when you don't need or want data hiding. If something has no private fields, make it a struct. If it has at least one private field, make it a class.

>>52627670

I would like to second the fact that it is indeed a pain in the ass to use Termux. If you can get any chroot application to work (i.e. Lil' Debi, Linux Deploy, Debian Kit, etc...), definitely use that.

If one does have to make use of Termux, it is probably best to use an editor that isn't Vim or Emacs, as they run like dogshit on Termux.
>>
Working on a variant utility for C++

template <typename T>
using Maybe = variant<none, T>;

int main ()
{
auto var1 = Maybe<std::string>::make<0>();
auto var2 = Maybe<std::string>::make<1>("something!");

assert(var1.get<1>() == nullptr);
if (auto ptr = var2.get<1>())
{
assert(*ptr == "something!");
}

using V = variant<char, int, double>;

auto var3 = V::make<2>(4.5);
// auto var4 = V::make<3>("Compile error!");

assert(var3.get<0>() == nullptr);
assert(var3.get<1>() == nullptr);
assert(*(var3.get<2>()) == 4.5);

return 0;
}


Yes I know boost probably has a bloated one of their own but I just wanted to try out my C++-fu and template metaprogramming fuckery
>>
File: ms.jpg (45 KB, 640x400) Image search: [iqdb] [SauceNao] [Google]
ms.jpg
45 KB, 640x400
Does anybody have any idea how to do stuff like this in C or C++? It looks like it's in 80x25 text mode, but I'm not sure.

If I need to use extended ascii, how do I do so?
>>
>>52628030
Google "ncurses"
>>
>>52628039
NO
ncurses is a fucking bitch and the API is horrible and it's super outdated and confusing.
Use "termbox" it's seriously great, SUPER simple API, very effective, very nice.
>>
>>52628045
this, ncurses is overkill 90% of the time
just use termbox if you need to do some simple TUIs
>>
>>52627974

Unrelated, but File::next_line has a memory leak.

>>52628045

It's also not portable.
>>
>>52628112
You mean deleting the char, right? I suppose I should use a unique pointer in that case.
>>
>>52627930
the idea of at least some of those new languages is that you'll be able to easily and efficiently interface with libraries from C/C++ and other languages while still being able to write the bulk of your application's code in a "better" language
>>
>>52628155

Since you mentioned in a previous thread that the lines were of constant length, and you were supposed to read this in line by line, why not just use std::getline()? No intermediate char[] buffer needed.
>>
>>52627074
InfoSec is literally everything and anything related to securing information. A large part of it relies on encryption, but the field of information security is far, far, wider than encryption.
>>
>>52628297
Yeah, I tried that yesterday while experimenting with the I/O commands. It doesn't work either.

Actually, nothing seems to work and I don't seem to really have any way of verifying that anything I'm doing is actually having any effect.
>>
>>52627942
>C++ ides on Android

Any anyone would recommend? I just tried two and the first one didn't seem to have keyboard support and I couldn't get the second to work right?
>>
>>52628352

That's not a complete sentence. Try again.
>>
>>52628352
It's great that you're doing research on your own, but try not to assume that everyone has read every book under the sun.
>>
>>52628360
lets try that again
Guys is the book i want to get called Beginning C# Game Programming Ron Penton and Beginning C++ Game Programming Michael Dawson any good

>>52628368
o sorry, but if there is any books anybody thinks can benefit me i would gladly take it too.
>>
>>52628390
check the gentoomen library, there's lots of great stuff in there. both are in there so you can try either one and see which looks better to you before making a purchase (if you want the hardcover)
>>
>>52622954
>gnome 3
>adwaita
>>
File: 1418066007417.jpg (50 KB, 797x621) Image search: [iqdb] [SauceNao] [Google]
1418066007417.jpg
50 KB, 797x621
>Using Spring
>Getting this error when generating a page
Failed to instantiate [controller.deposit.Deposit]: No default constructor found; nested exception is java.lang.NoSuchMethodException: controller.deposit.Deposit.<init>()


>I'm not calling a default constructor, I'm calling it with arguments

Here's the page's controller

@Controller
public class DepositController {
private String ip;
@RequestMapping(value = "/deposit", method = RequestMethod.GET)
public String depositForm(Model model, HttpServletRequest request) throws UnknownHostException {
ip = request.getRemoteAddr();
System.out.println("connection from " + request.getRemoteAddr());
model.addAttribute("deposit", new Deposit(ip));
return "depositSubmit";
}


@RequestMapping(value = "/deposit", method = RequestMethod.POST)

//Grabs the existing status from the model attributes
public String depositSubmit(Deposit deposit, Model model) throws UnknownHostException {
model.addAttribute("deposit", deposit);
return "depositResult";
}
}


I was looking into the error and some people said that this issue could be fixed by editing some XML file that I can't find, but all their examples had static constructors and static constructors are fucking pointless.
Does anyone know how I could solve this problem?
Why is spring so weirdly complicated with shitty documentation?
>>
>>52624996
Only use inheritance for polymorphism (even then I prefer interfaces). If you want to reuse code then just use composition god dammit.
>>
>>52626750
document.querySelector exists
>>
>>52627212
To be honest if there is a 1 in one million chance to give birth to a super hacker that means china has a thousand of those.
>>
File: Untitled.png (98 KB, 1610x909) Image search: [iqdb] [SauceNao] [Google]
Untitled.png
98 KB, 1610x909
>>52627974
lel something is clearly wrong with the way I set up the File object.

I wrote a minimal working example even featuring the more advanced C++14 crap I used--essentially a copy paste--and it works.
I don't know what I did wrong though. Pretty sure I did everything right.
>>
>>52623035
this is bait
>>
the function keys are ridiculously unresponsive

how should i map keys on a computer keyboard to musical notes?
>>
>>52628462
>found answers from all over the ner
>every single fucking one has the solution to be to hardcode the constructor values in the XML
Why the absolute fuck is this a thing? Why would you have a constructor with static values? That's fucking retarded. Why doesn't spring just let you use constructors like a normal person?
>>
Anyone know of decently featured GUI toolkits for C++ that aren't Qt? I want to see how they implement MVC.
>>
File: Untitled.png (93 KB, 1613x906) Image search: [iqdb] [SauceNao] [Google]
Untitled.png
93 KB, 1613x906
>>52628634
>tfw you don't even change the object, just dick around with pointers and everything suddenly works
>>
Hey guys, I'm learning JavaScript instead of C! Great decision huh!
>>
File: Bait.png (114 KB, 955x957) Image search: [iqdb] [SauceNao] [Google]
Bait.png
114 KB, 955x957
>>52628917
>>
>>52628928
>>
Is it easy to make your browser's file manager to be ranger, /g/?

I want to select my memes in a terminal.
>>
File: 1453014186202.png (300 KB, 363x428) Image search: [iqdb] [SauceNao] [Google]
1453014186202.png
300 KB, 363x428
>>52624039
You need to check if the input is only from ranges '0' to '9' like the other anons said.

Also, that function is nice and all, but a function that could translate multiple char digits to integers would be more useful overall.
>>
>>52628928
Dumb Reddit Fish poster
>>
>>52629044
you mean atoi?
>>
Will I get bullied for using shell scripts to build my C/C++ projects instead of Makefiles?
>>
>>52629109
yes kill yourself
>>
>>52629109
why would you even do that
>>
>>52629109
No. I do that too.
Build systems are just ricing shit that distract you from getting shit done
>>
>>52629109
Dunno about "bullied", but expect people to point out what a dumb idea that is.
>>
>>52629157
in today's sensitive touchy politically correct climate, simply disagreeing with someone is considered "abusive" bullying behavior.
>>
>>52629153
but you're just going to end up with something literally nobody except you can compile
>>
Hey guys, pretty new to programming.

I picked python because i got free access to Automate the Boring Stuff with Python on Udemy and all that and I'm almost done going through and doing all the practices + projects at the end.

I'll be going to university next year for programming, and I sort of wanted to get a head start. I want to work my way towards being able to program a basic emulator such as CHIP8 and work my way to NES and then a GBC emulator. After getting used to Python a bit more, I want to start learning C++ to start working my way towards this goal of making a GBC emulator.

What I want to ask is if C++ is a logical step? Should I be doing C next first and then easing into C++? For my emulator project (if i ever get around to it) I would also probably have to learn assembly and what not of the chips for each of the systems. How difficult compared to stuff like Python and C++ is it to learn assembly languages?

Sorry for the bunch of questions, but I'm really interested in programming as a hobby and a field and I'm pretty excited at the moment.

Also, I don't want to build the emulators to have them as a 100% ACCURATE SUPER BEST EMULATORS COMPETING WITH THE TOP EMULATORS type deal, I just want to understand how to write them and understand them better and get a better understanding of how the consoles I liked work at a base level. I eventually want to be able to write hobby code for larger emulators like the WIP WiiU and 3DS emulators.

Thanks to anyone who reads/replys to this.
>>
>>52629241
Skip python and move directly to C.
It'll make you appreciate python and C++ more.
>>
>>52629241
C is the logical next step
if you've never programmed in a language with C-like syntax, learning C will help you enormously before you go on to learning C++
>>
i learned assembly first, c second.

wouldn't bother with chip8. what makes emulators interesting is emulating the games you want to emulate. start with the system you like better of nes or gb.

c is enough to make a good emulator. c++ is way overcomplicated and not worth using for personal projects. but that's just my opinion.
>>
>>52629289
what's the point to learn c before c++ ?
>>
>>52629308
Good C++ is just C with Classes.
Don't bother with idiomatic C++.
Always strive to write C-style code when writing C++.
>>
>>52629289
you do realize python is a c-like syntax, right?
>>
Working on some shitty lcds adapters for a bloody banking system. Please kill me slowly.
>>
>>52629272
>>52629289
Thanks for the input! I'll do C next then to get a good grasp on it as I'll probably be using it for my university courses as well.

Do you guys have any recommended resources for learning C? I don't mind reading large books or anything as long as the methods are good.

>>52629305
Thanks for the insight. I was wary about making a CHIP8 emulator because I wasn't interested in a single game on it, and I heard conflicting opinions on if you should start with it or not.

Was there any resources you used to learn general assembly outside of the documentation on the consoles themselves?
>>
>>52622420
I'm making a video game for fun in C++ using the SDL library.
Anyone got an input on how vertical sync works and how to manage it ?

If I activate it using the SDL flag, it just slow down everything in my game. how should I manage that ?
>>
project euler in haskell. up to #4
>>
>>52629314
>Good C++ is just C with Classes.
C with Classes is bad c++. good c++ is about generic programming, raii, ownership, abstraction.
>>
>>52629318
I mean as in, a language with brackets instead of whitespace

aside from syntax, the fact that it's statically typed. That didn't really occur to me before but come to think of it that's probably going to be the biggest change
>>
>>52629153
how is a make file that you barely have to adjust at all a distraction from getting shit done?
>>
>>52629318
not at all, they have little in common.
>>
File: 1453782333093.jpg (84 KB, 861x1300) Image search: [iqdb] [SauceNao] [Google]
1453782333093.jpg
84 KB, 861x1300
>>52622420
>What are you working on
new ways to kill myself
have to make some kind of instant messenger and a 2k word paper on it by the end of this week
>>
>>52629308

C is a simpler language, and makes explaining C++ concepts easier. It's easier to understand this shit better if you go from the lower level on up, rather than the other way around.
>>
>>52629335
my input about learning C++ and C is a bit late since you already choose to learn C, but learning C or C++ will not make a lot of difference in the end.
You just have to know that C can be hard and I find it force you to think a lot about what you're doing, how to manage your project and structure it (which files to create, which structures, what to put in, where the functions goes, etc.).
Also you'll have to deal with the memory which is a great thing to know how stuff works in general, and permits you to do a lot of things. But if you can't into pointers, you're kinda fucked.

In the other hands, C++ is easier to maintain with the classes (it also depends on the project you're working on). But if you failed at making a good and maintainable code, you're doomed and will take a lot of time to do simple things.
>C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg. – Bjarne Stroustrup


Whatever the language you pick in the end, what is important is to make projects, try, fail a lot, understand your mistakes and how to structure your code. Once you know how to make a nice project, even if you're not "that" good at programming you can achieve a lot of things.
>>
>>52626750
concat returns a new list, it doesn't modify the old one.
>>
>>52627221
Literally nothing wrong with unity, it is the best desktop environment for Linux after KDE. Cinnamon is literally gnome shell trying to be KDE, gnome shell is too pretentious, xfce/lxde is for poorfags.
>>
>>52629241
java/C++ is the best start imo

>>52629314
kill yourself Ctard

Ctards never learn how to program in C++ or use OOP correctly. you're a prime example of that.
>>
>>52629437
doesn't make any sense, c++ can go as lower as c. also, learning low level stuffs first is one of the most shitty thing to do.
>>
>>52629441
I appreciate the input still. I don't mind it being hard. In fact, I actually prefer a more challenging language with more rigid syntax to learn rather than what I've been doing in Python.

Every example and program I've wrote in Python so far as "example projects" feel rather simple and feel as if they're shying away from the more intense concepts of programming, as if Python is only meant for simple tasks and it's offputting.

The only struggle I'm going to have is what resources to learn C. I hear outside of books, there isn't much to use and this this:

http://www.amazon.com/C-Programming-Language-2nd-Edition/dp/0131103628/

is the de facto standard of C programming books, but it seems a lot of people say it isn't the best starter tutorial (compared to those with reviews from 1997 and 2000 saying it is a sharp dive into C but still a good learning resource).

Any recommendations? I'm grateful for all the input you guys are giving me.
>>
>>52629471
I implement OOP in C whenever it's necessary.
You should never write OOP for the sake of using OOP, that's cargo cultism and the sign of a terrible programmer.
>>
File: hNjo63Z.gif (2 MB, 250x141) Image search: [iqdb] [SauceNao] [Google]
hNjo63Z.gif
2 MB, 250x141
Ask your beloved programming literate anything.

>>52629491
>I implement OOP in C whenever it's necessary.
You can not implement true oop in c.
>>
>>52629511
not all aspects of OOP are worth using
like member functions
sure, you can implement them in C, but since you have to explicitly pass a pointer to it's own member function, what's the point?
Why couldn't that function be kept outside of the struct?
>>
>>52629511
>true oop

HERE WE GO AGAIN
MY MY
>>
>>52629484
Can't tell you I'm not english. I started to learn online. There's a lot of tutorials and online books to learn.
>>
>>52629511
Are you a girl?
>>
>>52629564
No worries, I'm sure I'll figure it out. Thanks again.
>>
File: Linus_Torvalds_05.jpg (3 MB, 2346x2346) Image search: [iqdb] [SauceNao] [Google]
Linus_Torvalds_05.jpg
3 MB, 2346x2346
Is he right? Should tabs be 8 characters long?
>>
>>52629655
no

4

and you should use tabs for indentation not spaces

spaces are fucking disgusting
>>
>>52629655
Most non-trivial code requires at least 4 indents.
he's just a hack
>>
NEW THREAD!

>>52629675
>>
>>52629682
Who the fuck use tabs like this in 2016 ?
Didn't we all agree that tabs should indent using 4 spaces so it doesn't fuck up whatever the IDE / text editor you use ?
>>
>>52629703
your editor can display tabs as any number of spaces you want.
Don't be dumb.
4 space tabs is master race tho.
>>
>>52629703
the source code should contain tabs

the width of the tabs should be equivalent to 4 spaces

it shouldn't put 4 actual spaces, it should be an actual tab just with the width of 4 spaces
>>
Want to learn a language that will be useful in finding decent paying job with no related degree without resorting to handmade minecraft mods and donations from children, what's the best choice?
Or would that actually be feasible?
>>
>>52630415
If you want to just exploit suckers for cash like that, learn to draw furry porn and set up a patreon
>>
>>52630448
Unfortunately my drawing skills are shit and I'd learn how to code quicker. I don't get much free time outside of work but I want a language I can do something with that will eventually require less effort or just let me work from home so I can perpetually fund my travel addiction instead of work 6 weeks and get 2 weeks off.
>>
>>52629703
>2016
>Using text editors that can't display tabs as however many fucking spaces you like

POO IN LOO
>>
>>52627040
try management?
>>
>>52629655
No, even giants can be wrong about things though. Bjarne for example is wrong about using tabs for indentation.
>>
>>52630740
there is no argument for using spaces other than that the most primitive editors such as literally notepad might have tabs at 8 spaces wide with no option to change it
>>
>>52630740
>Using spaces for indentation
>Literally forcing your shitty, incorrect opinions on everyone who has to look at your code
>>
>>52629655
Kerneldoc says use tabs, but tabs should be displayed as 8 spaces.
You can display things however the fuck you like in your own editor, all it means is that you have to keep within 80 chars/line assuming some people will be using 8 space tabs.

This is pretty logical since most terminals default to 8 space tabs, and wrapping lines in terminals is fucking hideous.
Thread replies: 314
Thread images: 31
Thread DB ID: 475693



[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 / qst / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vip /vp / vr / w / wg / wsg / wsr / x / y] [Search | Home]

[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 / qst / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vip /vp / vr / w / wg / wsg / wsr / x / y] [Search | 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.
This is a 4chan archive - all of the shown content originated from that site. This means that 4Archive shows their content, archived. If you need information for a Poster - contact them.
If a post contains personal/copyrighted/illegal content, then use the post's [Report] link! If a post is not removed within 24h contact me at [email protected] with the post's information.