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

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 312
Thread images: 21

File: K&R himegoto waifux2.png (1MB, 1000x1400px) Image search: [Google]
K&R himegoto waifux2.png
1MB, 1000x1400px
old thread: >>52309675

What are you working on, /g/?
>>
>tfw programming anti-adblock software
>>
Thinking out a JSON structure for muh configuration.
>>
File: crying umaru.jpg (36KB, 600x337px) Image search: [Google]
crying umaru.jpg
36KB, 600x337px
Why do people act surprised and make fun of me after they find out I write all my software in C?
>>
Working on understanding observational type theory, and upgrading my language from its intuitionistic type theory base.
>>
Why don't you compile to PDF, /dpt/?
>>
>>52315068
How many lines of code do you write per day on average /dpt/?

Don't lie.
>>
>>52315139
100 maybe?
>>
>>52315108
>Why do people act surprised and make fun of me after they find out I write all my software in C?
Because they didn't want to know that and they just wished you would fuck off and kill yourself.
Transvestite faggot
>>
>>52315139
3.5
>>
>>52315108
because they're script kiddies and think C is some thing from the hipster dark ages
>>
>>52315150
Why do you think i'm the trap shitposter?
>>
12th for Java
>>
13th for Java
>>
14th for Java
>>
15th for compiling to pdf
>>
C #define macros are basically for when I want to write generic inline functions, right?
>>
>>52315407
Yes, but beware. Macro could be dangerous. It require skills to be handled correctly.
>>
>>52315407
They're also a method of implementing static consts without wasting memory on runtime.
>>
>>52315480
It's patented by google (or java, I don't remember). And it's not a joke.
>>
>>52315480
>4 bytes saved
wow
>>
>>52315497
what?
>>
>>52315502
There are a lot of things that are patented.
>>
>>52315499
I didn't say it was a particularly good method.
>>
>>52315513
Why is this even allowed?

What's stopping me from going to some shitty jusidiction and patenting the loop?
>>
Just started working on a fully customizable personal assistant/waifu in java. anyone have any suggestions?
>>
Just finished a Brainfuck interpreter lads
>>
>>52315763
*translator
>>
>>52315763
I'm impressed. You must be a serious hacker.
>>
Fuck Java
>>
>>52315446
>don't use mutation operators as arguments for a macro
such skills, much danger, wow
>>
>>52315763
Does it deal with nested loops?
>>
>>52315936
Don't do stupid things required a lot of skills. If you were a true coder who hack into other's code you would know that.
>>
>>52315948
it does
>>
>>52315480
wut?
>>
>Discover last night that Rust's panic! macro generates an illegal instruction (ud2).
>Ask one of my professors (who is perhaps the most well-versed in the department about compilers) if there are any circumstances where it might be reasonable for a compiler to emit an illegal/invalid instruction (mentioning that this is used once by the Linux kernel through inline assembly as a way of intentionally crashing everything).
>"No, never."
>Decide to look into this further later on.
>It's not so much that Rust is generating that instruction, but that LLVM's "trap" intrinsic that generates it.

Why the hell does LLVM do this? I have never seen GCC emit an illegal instruction unless explicitly through inline assembly. If a process needs to stop due to an error, which makes more sense - executing an invalid opcode, or just making a system call to exit? The latter is standard, and does not cause any secondary effects (i.e. being caught by a signal handler, or having the operating system inform the user about committing an illegal operation).
>>
>>52315108
>I write all my software in C?
HAHAHAHHAHAHAHAHAHAHAHAHAHA!
>>
>>52315407
just write a normal generic function and use
[MethodImpl(MethodImplOptions.AggressiveInlining)]
>>
>>52316154
Because LLVM is designed and developed by retards (i.e. appfail employees). Bad decisions is their bread and butter.
>>
Reminder to program in OCaml, unless you're a masochist!
>>
>>52315090
you still haven't explained yourself

or are you just memeing at this point?
>>
>>52316313
But I use F# because it actually has an ecosystem
>>
>>52315108
kill yourself

>>52315139
kill yourself
>>
>>52315826
kill yourself
>>
>>52316154
llvm intrinsic::trap being ud2 makes sense since that's is exactly what it's supposed to do.
rust's panic! compiling to that intrinsic is what doesn't make sense though, should just have a regular exit or maybe debugbreak type call.
>>
File: hamster-escape.jpg (26KB, 400x402px) Image search: [Google]
hamster-escape.jpg
26KB, 400x402px
>no hamsters
Hamsters.
>>
File: hand3.png (1MB, 1200x1000px) Image search: [Google]
hand3.png
1MB, 1200x1000px
>>
File: umaru eats the pizza.png (654KB, 580x582px) Image search: [Google]
umaru eats the pizza.png
654KB, 580x582px
>>52316428

Umaru can get good at literally anything without even trying, what programming language would she learn?
>>
>>52316295

How unfortunate. I'm actually starting to like Rust a little, and yet I feel in some areas, I'm going to be fighting the compiler to not generate shit code. I'm also not so much liking the massive amount of dependencies that get added any time one uses any part of the standard library (if I am not doing networking, I should reasonably expect that my program will not require Rust's built-in networking library), but I guess this just means it would be unreasonable to use it for creating static libraries. With executables... it's less important to have a bloated binary size.
>>
>>52316444
Malboge
>>
>>52316154
>>52316295
http://llvm.org/docs/LangRef.html#llvm-trap-intrinsic
something seems wrong here...
>>
>>52316444
C++
>>
File: 1450530245913.jpg (12KB, 177x278px) Image search: [Google]
1450530245913.jpg
12KB, 177x278px
>>52316446
>I'm actually starting to like Rust a little
>>
>>52315068
This seems to be the thread I should be visiting. /g/ has been kind of a disappointment for me, the focus seems to be on the hardware side of technology, and I rarely see any code in this thread. Are there better online communities for the discussion of programming?
>>
>>52316663
It's 4pm on a friday, the only people in here right now are shutins and neets.
>>
File: fizzbuzz of the christ.png (402KB, 1024x768px) Image search: [Google]
fizzbuzz of the christ.png
402KB, 1024x768px
>>52316663
Have some code lad
>>
>>52316663
programming is more than just code
>>
>>52316663
maybe endchan. There's a reason why /g/ focuses on hardware, though, and it's because programming isn't technology any more than calculators are mathematics, and there's nothing to discuss until a large company announces a new language or library.
>>
>>52316685
It's 1pm on Saturday though.

>>52316663
People aren't going to post large swaths of code here. This thread is for general discussion of programming, but is rife with shitposting.
>>
>>52316719
1am
>>
>>52316719
Really, I only come here whenever I can't debug something.
>>
>>52316719
I guess large swaths of code are what I am looking for. I have been programming on and off for about seven years. One of The best ways that I have found for learning is examining other people's code. I just don't get that on /g/. Something that has an active Skype community or IRC would be nice as well.
>>
File: 1451148605227.png (303KB, 405x692px) Image search: [Google]
1451148605227.png
303KB, 405x692px
Brainfuck translator lads

import sys

inputType = sys.argv[1]
if inputType == "cmd": string = sys.argv[2]
elif inputType == "file":
myfile = open(sys.argv[2])
string = myfile.read()
myfile.close()
else: print "Only 'cmd' and 'file' valid"; sys.exit()

cells = 30000
reg = [0 for i in range(cells)]
ptr = 0 #reg pointer
pc = 0 #string pointer
loopStk = []

#input in the form of an int, output in the ascii representation of an int
while pc < len(string):
curSym = string[pc]

if curSym == "+": reg[ptr] += 1

elif curSym == "-": reg[ptr] -= 1

elif curSym == ">":
ptr += 1
if ptr >= cells:
print "Over array bounds."
sys.exit()

elif curSym == "<":
ptr -= 1
if ptr < 0:
print "Under array bounds."
sys.exit()

elif curSym == ".": sys.stdout.write(chr(reg[ptr]))

elif curSym == ",":
try:
reg[ptr] = int(input())
except:
print "Invalid input."
continue

elif curSym == "[":
if reg[ptr] == 0:
loops = 1
while 1:
pc += 1
if string[pc] == "[": loops += 1
elif string[pc] == "]":
loops -= 1
if loops == 0: break
else: loopStk.append(pc)

elif curSym == "]":
a = loopStk.pop()
if reg[ptr] != 0:
pc = a
continue

pc += 1
>>
>>52316759
>>>/reddit/
>>
>>52316779
But I don't have any cocks in my mouth, anon. Pretty sure that's a requirement for entry, or are you serious and not just shitposting?
>>
>>52316798
>>>/tumblr/
>>
>>52316759
Why not just browse random stuff on Github?
>>
>>52316833
Not a bad place to start, I suppose. Thank you.

>>52316779
>>52316829

Thank you as well.

It's a hard life being an unemployed white hat. I don't have any incentive to work on projects beyond my own drive. Any ideas on that front, gentlemen?
>>
>>52316866
I recommend starting either with a tankfull of helium or with cyanide pills
>>
Alright, let's see how this goes:

https://github.com/rust-lang/rfcs/issues/1454
>>
File: BUNBUUU.jpg (107KB, 932x651px) Image search: [Google]
BUNBUUU.jpg
107KB, 932x651px
How does this make you feel, /g/?
The whole world is looking down at you ANSI C ALL DAY autists.

https://matt.sh/howto-c
>>
Why do functional languages have to have such weird syntax for it?
wikipedia's article on D says to do this
int function(int) g;
g = (x) { return x * x; }; // longhand
g = (x) => x * x; // shorthand

never mind the fact that it doesn't compile, what would be the difference between that and this
int g(int x) { return x * x; }
>>
In Python, how would I write a function that can take a variable number of arguments eor a list?
>>
>>52316981
second form isn't nearly as pretentiously opaque

how can functionalfags stroke their precious ego to something that makes sense to everyone?
>>
>>52316981
That's just D.
>>
>>52315139
Depends on my schedule. Anywhere for 0 to 300. I'd say because I'm in school it averages to about 10-20 lines per day.
>>
>>52317009
*args
>>
>>52317009
def f(*someValues):
for i in someValues:
print i
>>
>>52316866
>It's a hard life being an unemployed white hat.
jesus
>>
>>52316100
const int USD_TO_JPY = 117

This has a performance penalty, because the variable is stored in memory. The following:
#define USD_TO_JPY 117

Does not, because no memory is used by preprocessor expansion.

It's kinda a niche and there's not really that many cases where you'd want to use it, but it's still an option.
>>
>>52316981
Yours has type annotation. D's first example is the same, but with type inference (I think, seems like it). That allows it to be used polymorphically without a rewrite. Of course, given the code in the function can work for the given type and that the function leaves no ambiguities as to the return type. If teh compiler can't figure it out, it will complain and you'll probably end up being required to write what you wrote to help it.
>>
>>52317081
Wow, you saved 1 whole byte.
Thanks, Mr. ANSI C embedded software professional! Where would we be if we couldn't squeeze in just 1 MORE BYTE???
>>
>>52316981
let g x = x * x

let g = fun x -> x * x

????????????????????????????????????????????????????????????????????????????????

Meanwhile in dysfunctional languages
int(*g)(int);
int gi(int) {
return x*x;
}
g = &gi;

g = [](x){ return x * x; }
>>
>>52316866
>It's a hard life being an unemployed white hat

Lol
>>
>>52317009
You also have keyword arguments
def f(arg, *args, **kwargs):
print arg
for arg in args:
print arg
for arg in kwargs:
print "{}: {}".format(arg, kwargs[arg])
>>
>>52317081
False. Check the assembly, retard.
>>
>>52316940

On many of these points, I'll agree with them, especially with the not using long for pointer math. In fact, I cringe every time I see code that operates under the assumption that sizeof(long) == sizeof(void*), which is not true on 64-bit Windows.

I won't agree on the usage of #pragma once though. I'm going to continue using #ifndef guards until it gets put into the standard. Also, fuck the "no malloc" shit. Calloc is bad for performance, and users can reasonably do their own overflow checking if there is a chance that their code might malloc over an exabyte of memory.
>>
>>52317113
Not him, but if you're going to choose between the 2, why choose const int?
>>
>>52317113
>ints are 1 byte
ok grandpa, it isn't 1988 anymore
ints in C are usually 4 bytes these days
>>
>>52317140
>I won't agree on the usage of #pragma once though. I'm going to continue using #ifndef guards until it gets put into the standard.
Just use both.
>>
>>52317147
If you really care about using constants smaller than 255, you would set it as a
const unsigned char USD_TO_JPY = 117;
>>
>>52317145
Error messages will be more meaningful as they can refer to the constant instead of the value it represents. There is also no performance hit in using const int instead of #define.
>>
>>52316923

Did you let them know about the return type mix-up you had? unit/u32 or whatever it happened to be?
>>
Threadly reminder that you should not refer to the act of programming as coding. It is improper and makes you look like a 16 year old

You are a programmer, not a coder

Software Alchemist is GOAT
Developer is okay
Magician is okay
Software Magus is okay
Software Engineer is okay
Software Architect is okay
Code Guru is okay


Archmage is reserved for only the most senior of programmers

Writing in HTML and CSS is not programming, therefore it should be referred to as designing
>>
>>52317061
>>52317059
I was under the assumption that was just for variable args. Would I then have to check if the args list size is 1 and the only value is an iterable to catch the possibility of a single iterable input?

In Lua it would look like this
function f(...)
local args
if select('#', ...) == 1 and type(select(1, ...)) == "table" then
args = select(1, ...)
else
args = {...}
end
for i in ipairs(args) do
print(i)
end
end

I find that really messy, but it works for what I want it to do.
>>
golang is a shit language for hipsters that climb the nearest shiny thing off in the distance
>>
>>52317209

Go back to the other programming pasta you miserable kid
>>
>>52317217
It works for 1 argument
>>
>>52317145
Suppose that you decide that rounding to the nearest Yen isn't accurate enough, so you do
const int USD_TO_JPY = 117.1;

or
#define USD_TO_JPY 117.1


The first one will give you an error message that refers directly to the problem. The second will either give you an error message which refers to the point where you used the macro and won't make any sense unless you track down the macro definition, or at worst will just silently produce broken code.

Basically: don't use the preprocessor any more than is absolutely necessary. Use inline functions rather than function-like macros, use consts or enums rather than variable-like macros.
>>
>>52317247
Okay. I see *iterable expands an iterable so thay can be used as function arguments.
def f(*someValues):
for i in someValues:
print i

f(*[1, 2, 3, 4])
>>
File: omg coffee.jpg (336KB, 859x687px) Image search: [Google]
omg coffee.jpg
336KB, 859x687px
What's stopping me from making my own programming language and accompanying standard library as a bunch of C typedefs?
>>
>>52317269
You shouldn't use inline functions anyway because the compiler is better than you at deciding whether or not a function should be inlined.

Another advantage to not using the preprocessor is that the compiler can much more easily output better code depending on changing optimization flags (e.g. space v.s. speed) with constants than with macros.
>>
>>52317296
Yep, it's called unpacking in python

Alternatively, you could do:
f(1,2,3,4)

and it would work the same
>>
>work with complex numbers in C++
>had to make this workaround

#define I complexf{0,1}.imag()
>>
>>52317342
It's actually

#define I std::complex<float>{0,1}.imag()


I just made a typedef for legibility
>>
>>52317342
>being this retarded
>>
>>52317361
Nice job, you've just defined "I = 1.f".
>>
>>52317299
Your sanity.
>>
>>52317342
en.cppreference.com/w/cpp/language/user_literal
>>
Simple question: I'd like to compile an SDL application on Windows and Linux. Basically I just want to dick around on either machine, and use dropbox to sync after doing something.

On Windows, I need to link -lmingw32, as I'm using Code::Blocks and mingw. On Linuxt (Mint), linking mingw will cause errors, though I could install mingw32 and see if the program doesn't shit itself.

One idea was to have a custom make or some shit, so if it detects windows it links mingw, but if it's linux it doesn't. That seems like it'd be a pain in the ass going forward, as instead of using this or that IDE feature I'd be manually editing files.
>>
>>52317302
> You shouldn't use inline functions anyway because the compiler is better than you at deciding whether or not a function should be inlined.

The compiler typically can't inline functions from another translation unit. If you want the possibility of inlining, it needs to go in the source file where it will be used, or in a header. And if it goes in a header it must be declared "static inline" to avoid multiple definition errors.

"inline" is much like "register". It's mostly a hint to the compiler (the compiler can inline functions which aren't explicitly declared "inline", and it can decline to inline functions which are explicitly declared "inline"), but it does also have actual defined semantics.
>>
>>52317410
in your makefile

ifdef __LINUX__
do thing
else
do other thing
>>
>>52317435
I think I must just be able to do other build targets right? Off to test.
>>
>>52317410
I haven't actually used Code::Blocks, but any credible IDE will let you use environment variables in the build configuration.
>>
>>52317410
The other option is using something like Cmake, so you can have your application spit out Mingw makefiles, linux makefiles, and even VS projects.

Mingw is dead btw, mingw-w64 is the future.
>>
>>52317419
>The compiler typically can't inline functions from another translation unit.
It's not 1972 anymore.
>>
>>52317370
>>52317363

Nah. That makes 0 + 1i, which is i.

http://en.cppreference.com/w/cpp/numeric/complex

>>52317404
I read that. std::complex_literals didn't seem to work so I did that workaround.
>>
File: 1308097591001.png (25KB, 604x453px) Image search: [Google]
1308097591001.png
25KB, 604x453px
>>52317546
The return type of std::complex<T>::imag() is T. Not another complex number.
>>
>>52317546
Oh, now I see. The .imag() part was not needed... I'm a retard
>>
>>52315068
Nice
>>
>>52317483
I'll check that out eventually I guess.

>>52317476
I was able to solve it with different build targets.
>>
Made an Ook! translator which calls my Brainfuck translator after converting orangutan to BF symbols lads
>>
>>52317410
See "3.2.8 Conditional Evaluation" in the C::B manual.
>>
>case sensitive filenames
Unix is retarded.
>>
>>52317322
Yeah, Just writing a function I wanted to able to use both forms.
gcd(48, 60)
or gcd(*[48, 60])
The second is helpful for large lists.
def gcd(*args):
return reduce(lambda x, y: x * y, [d**p for (d, p) in (reduce(lambda x, y: x & y, [Counter(decompose(x)) for x in args])).items()])

Where Counter is in collections and decompose is a function I wrote that decomposes a number into it's prime factors. I'm sure writing an extended version of euclid's method would be faster, but other than that snag it was faster to write. lcm function is the same code with & changed to |.
>>
>>52315094
>Using a format that does not allow for comments as configuration file.
Are you a retard? Use YAML instead.
>>
>>52317660
>>case sensitive filenames
>Unix is retarded.
There is literally no way you think case insensitive filenames are actually better... please... don't say it. I'm on my last nerve.
>>
>>52317660
Why shouldn't filenames be case sensitive?
>>
File: CIcKi3g.png (51KB, 200x195px) Image search: [Google]
CIcKi3g.png
51KB, 200x195px
>>52317711
insensitive filenames are actually better
>>
>>52317507
Link-time optimisation isn't inlining, it's a fairly new feature, and not exactly one of the more reliable ones. Putting a function in a different source file to the one that's going to call it is a good way to ensure that, for most people, it won't get inlined.
>>
>>52317660
>this is what python users actually believe
>>
>>52317570
I realised, thanks for the heads up though.

I think I got pretty used to some languages where doubles are usually complex numbers.
>>
>>52317660

>Windows pathname length?

Lets not bother.
Spend a little time learning Unix, eh?

For the record, I'm posting from a Windows 8 box.
>>
>>52317740
What does this have to do with python?
>>
>>52317697
Python is really good for writing unreadable code isn't it anons?

Would formatting help? Or a comment?
>>
>>52317740
Python is case sensitive
>>
>>52317708
>using anything but sexp
Funny guy!
>>
File: c-1.png (357KB, 454x603px) Image search: [Google]
c-1.png
357KB, 454x603px
>>52315108
Because they're dirty hipster faggots, Anon. Time to get used to there being very few gentlemen of scholarly disposition out there.
>>
>>52317736
No.
>>
there is no point in having case sensitive file names

it just opens up opportunities for errors and confusion
>>
>>52317767
Understanding list comprehensions would help you
>>
>>52317660
No, it's you who's retarded.

Case folding requires treating bytes as characters, which means putting the locale stuff into the kernel. Which is kind of a problem on a multi-user system (admittedly not something MS really has to worry about, limiting themselves to consumer-grade junk), because you end up with the situation where two filenames are the same for one user but not another.

Or did you think the entire world uses ASCII?
>>
>>52317740
Ironic that so many fags here bash python for significant whitespace while their own languages have case sensitivity, which is as bad.
>>
>>52317809
significant whitespace is an anti-python meme, since you take up more space with braces in other languages, and in python, you can put multiple statements in one line still, and use less than 4 spaces for each indent
>>
>>52317834
kill yourself
>>
>>52317849
nice meme
>>
Why is Pascal so comfy?
>>
>>52317797
> there is no point in having case sensitive file names
> it just opens up opportunities for errors and confusion
You have it backwards.

Case-sensitivity isn't a "thing". Case-folding (treating distinct characters as "equivalent") is a thing, and it's a bloody complicated one at that.

Life is much simpler if you just accept that 65 isn't equal to 97, not even sometimes. That goes against some people's intuition, but favouring intuition over logic is the road to hell where computers are concerned.
>>
>>52317857
i don't even mean it in the meme sense i literally think you should kill yourself

significant whitespace isn't about saving space fucking retard
>>
>>52317873
good type system
>>
>>52317799
How so? I don't think I can replace any more of my code with a list comprehension.

The most nested comprehension turns all the arguments into a list of multisets of their prime factors. The first reduce intersects (in the case of gcd, unites in lcm) all the multisets to form one multiset that represents the gcd of the list of arguments. Then the next comprehension applies the number of each elements as a power to the element in the multiset to make a list of numbers, that when multiplied (which the final reduce does), makes the gcd.
>>
>>52317882
I literally think that's a nice meme

You would indent in the exact same cases in other languages. You lose braces. Where is this significant whitespace? Fucking dumbass
>>
>>52317899
I thought you were another anon
>>
>>52317879
autist detected

for example if a human being has a file called nigger.png and wants to overwrite it, but accidentally writes Nigger.png, it shouldn't create a distinct file so that when they upload nigger.png to 4chins it's the wrong image. it's very easy to make simple and clear rules about which characters are allowed in filenames and which are considered as equivalent
>>
>tfw juggling between about 50 different projects in 4 different languages
I hate being a codemonkey
>>
>>52317809
Almost every modern language is case-sensitive.

Most of the ones which aren't were designed in an era where you couldn't assume a system actually supported lower-case.

FIVE BIT BAUDOT CODE SHOULD BE MORE THAN ENOUGH FOR ANY APPLICATION +++STOP+++

Now get off my lawn.
>>
>>52317923
>tfw only language I use at work is SQL
Just fuck my career up senpaitachi
>>
>>52317917
No, I personally think it's rather unreadable to put that much shit on one line AND it's all nested. Something like this would be more readable.
def gcd(*args):
return [Counter(decompose(x)) for x in args]@x -> reduce(lambda x, y: x & y, x)@y -> [d**p for (d, p) in y.items()]@z -> reduce(lambda x, y: x * y, z)
>>
>>52318016
It's unreadable to put so much shit in one line regardless of format.

If you understand list comprehension, the first is simple anyway. If you understand the format in this code, it's more readable that way.
>>
>>52317920
Amerifat detected.

> it's very easy to make simple and clear rules about which characters are allowed in filenames
So you've never actually dealt with internationalisation in any shape or form, and you literally think that A-Z is the entire alphabet?
>>
>>52318094
>other countries make 9trillion letters or can't even figure out an order to their alphabet
Fucking L O L

How do the Chinese even find their files???
>>
>>52317697
>>52318016
both are ridiculously disgusting
>>
>>52317920
So, what about Chinese? Should we ignore filenames written in Chinese characters, and flatten them to Pinyin? Should Japanese filenames written in Kanji and written in Kana be equal? What about languages like German and French? Should their accented characters be treated as unaccented or not? What about duplicate chars in Unicode? Should X == == x == == ⨯ == ╳?

Shitty programmers like you are the reason that codepages existed for so long. I bet you still write Unicode unaware software. This is almost as stupid as that guy who tried to argue that we shouldn't use Unicode in modern software, because it isn't as good as it could possibly have been.

I will admit Unicode has some flaws though. Characters like
>>
>>52317777
Quads don't lie.

ANONS how much of a programming language should you know before putting it on a resume?
>>
>>52318094
>>52318226
#justplebthings

i swear software to you is nothing but sorting data base entries, manipulating strings and dealing with files
>>
>>52318226
I get so much shit from foreign clients because the dev team developed unicode-unaware software from the get-go, and with how undocumented it's gotten, there is no saving it
>>
>>52318239
Enough to know whether you'd be comfortable writing a large project in it.
>>
>>52318249
You are the shitty programmer here. If there is any text, anywhere in your program, which their almost certainly fucking is, you've probably fucked up your Unicode support.
>>
>>52318276
there is no user-entered or user-generated text in my parts of the program
>>
>>52318226
>non-english languages in tech
SJW tier.
Learn english or fuck off back to ploughing rice fields.
>>
>>52318249
>#justplebthings
>wanting to actually produce good software
>being employed writing software that clients can actually use
>not being an amerifat NEET on /g/
>>
>>52318270
define large?
>>
>>52318287
he means hard-coding english into your program by putting english string literals all over your code

it's the mark of the amateur and disgusting as fuck
>>
>>52318297
"Indefinite in scope"
>>
>>52318263
>doesn't have a tool which creates a list of every character used in a document
How the fuck do you not even have that? PDFs are based on distinguishing every character
>>
>>52318286
Hope it doesn't display anything to the user either, because you need to properly support Unicode for that also. Hope that it never takes input from a file, and has no network connection. If all you are doing is writing pure mathematical routines, fine, ignore Unicode, as long as you never have to actually take any fucking numerical input.
>>
>>52318321
Who cares? Third world shitholes with their non-english OS and software can go fuck themselves.
If it works on an american computer, it works. If some rajeev or ching chong can't use it, I don't give a fuck.
>>
>>52318239
>how much of a programming language should you know before putting it on a resume?
C

If you know C it's acceptable to put C++, Obj-C, C#, Java, D, Go, Perl, Scala and everything else similar
>>
>>52318343
>I don't have to do any of that for my job
>HOW DARE YOU NOT DO THINGS THAT ARE NOT A PART OF YOUR JOB
Are you retarded?
>>
>>52318343
>he is this butthurt
>>
>>52318343
>unicode sjw

i hate this place
>>
Implement a FIFO queue with two LIFO queues
>>
>>52318366
Pls don't do this.
If they see a bunch of languages on your resume, it will set off their bullshit alarm and you will be asked to prove that you know Go, and Scala and everything else similar.
>>
>>52318365
and nobody gives a fuck what a cuck employee thinks lmao
>>
>>52318366
lel
>>
>>52318369
>>52318367
Shitty programmers who fail to understand Unicode fuck things up, all the fucking time. They even fuck up plain english, because they are incompetent. If you want to write Unicode unaware code, be my guest, but don't expect to be respected as a good programmer.
>>
>>52318392
>prove that you know Go
Then you prove it, because Go is similar enough to C that you could learn it decently in an hour

they won't be using anything on that list past java, so they almost certainly won't care enough to ask
>>
File: 0v70lxzkamb36w.png (241KB, 750x516px) Image search: [Google]
0v70lxzkamb36w.png
241KB, 750x516px
>>52318417
So much this.
If your code doesn't support skin tone modifiers in emoji, you're a shit programmer.
>>
>>52318437
You don't have to actually display it, but your code should not crash if someone inputs an emoji skintone modifier character.
>>
>>52318488
>Program crashes if used by a shitskin
It's not a bug, it's a feature.
>>
>>52318417
>Unicode

I hope this meme goes away at some point.
>>
i want CRUDfags to leave
>>
>>52315119
You don't have to try to impress us anon, we have contempt for everybody.
>>
>>52318417
so just stick to ascii then? Easy enough if you aren't doing CSS.
>>
Just want to say /dpt/ is useless at giving advice.

You're no help at all.
>>
>How to C (as of 2016)

https://matt.sh/howto-c

>The first rule of C is don't write C if you can avoid it.

Well said my friend, well said.
>>
>>52318529
>I want 99.9% of programmers to leave
>>
>>52318554
How is it impressive if I don't get it?
>>
>>52318647
>CRUD
>99.9%
>implying
>>
>>52318431
Good luck learning go decently in an hour in the middle of an interview you dumb fuck.
>>
>>52318624
>C99

REEEEEEEEEEEEE
>>
>>52318668
>>CRUD
>>99.9%
>>implying

It really is, though.
>>
>>52318678

Exactly. C11 should be preferred.
>>
>>52318616
Cry more bitch lol
>>
>>52318624
Is the info in this guide good? If not is there another site like this?
>>
>>52316923
So their answer is basically "we have no idea what we're doing but it's faster I guess? Nevermind the fact that C doesn't need it though, I'm sure we know better than any gcc or clang dev."
>>
>>52318388
import java.util.Deque;
import java.util.ArrayDeque;

public class MyStack<T> {

private Deque<T> a = new ArrayDeque<T>();
private Deque<T> b = new ArrayDeque<T>();

public void push(T input) {
while (b.size() > 0) {
a.push(b.pop());
}
a.push(input);
}

public T pop() {
while (a.size() > 0) {
b.push(a.pop());
}
return b.pop();
}

public static void main(String[] args) {
MyStack<Integer> test = new MyStack<Integer>();
for (int i = 0; i < 100; i++) {
test.push(i);
}

for (int i = 0; i < 30; i++) {
test.pop();
}

for (int i = 100; i < 130; i++) {
test.push(i);
}

while (true) {
System.out.println(test.pop());
}
}
}
>>
>>52318716
It's literally just telling you to write idiomatic C99.

Ignore the part about types and no chars, he's autistic.
Don't ditch include guards, #pragma once is non-standard garbage.

Do not put your shit on the stack if it was already on the heap, you put it there for a reason.
And use enumerated types instead of booleans.
>>
File: Screenshot (16).png (180KB, 1920x1080px) Image search: [Google]
Screenshot (16).png
180KB, 1920x1080px
>>52318226
W I N D O W S
I
N
D
O
W
S
>>
>>52318716
Yeah mostly. Can't really object to anything but the no braces on single lines thing. I like the way it looks.
>>
>>52318793
He's right, though. Who cares about non-standard? The C ABI is not prescribed by the standard and yet everyone relies on it. Nothing wrong with doing the same with #pragma. As for types, he even gives arguments as to why you shouldn't use the default ones.
>>
>>52318668
it kinda is tbqh

think accounting n shit like that
>>
>>52318803
the hell are those last ones even supposed to be?
>>
File: tumblr_nmxuz0UN6z1titub2o1_500.png (60KB, 500x407px) Image search: [Google]
tumblr_nmxuz0UN6z1titub2o1_500.png
60KB, 500x407px
>tfw you needlessly indulged in eating an excessive amount of cheez ballz
>>
Python and Java enterprise dev here

I've got the basics of C covered and the paradigm seem quite different to how I usually approach a programming problem.

I'm thinking of reading this to get a better idea of how software is actually built:
http://www.amazon.co.uk/Interfaces-Implementations-Techniques-Addison-Wesley-Professional/dp/0201498413

Is it worth it? Or is a there a guide for getting a good C programming technique nailed down somewhere.
>>
>>52318972
Shit taste
>>
>>52318972
>tfw six pack and naturally eat little food
>>
Are most programming books just fluff?
I've read 6 books on C intended for various levels of expertise and they pretty much just repeat the same shit over and over, even when they try to cover "best practices".
>>
>>52318972
Become bulimic anon, it helps.
>>
>>52319070
>Are most programming books just fluff?
don;t read 6 books about C. SURELY there are better books you could be reading.
>>
>>52318982
>Python and Java dev
>the paradigm [of C] seems quite different to how I usually approach a programming problem

someone post that one webcomic.
>>
>>52319070
I've learned how to program by reading my compiler's reference manual.
Why would you read a book when all you need to know about the basics is already there?

After that, pick up a data structures and algorithms book and you're set.
>>
File: olw-cheez-ballz-225g.png (349KB, 357x600px) Image search: [Google]
olw-cheez-ballz-225g.png
349KB, 357x600px
>>52318998
you mean these? they taste quite nice imo i hadn't had them in years and i ended up eating probably a third of or half the bag
>>
>>52319070
it's about finding the right books senpai, most cover just the core language.

this is my python progression:
1) python 3 OOP
2) python in practice
3) core python applications programming

and then I just do projects like right now I'm writing an AI for a board game. Also if there's a specific area you're interested there might be a book on that.
>>
>>52318972
Tfw you don't eat shit, to the point where you get headaches and lightheadedness from lack of food, but are still overweight. My body is ghey. Also turned out much shorter than my dad and grandfathers. Thanks for the high-estrogen diet mom!
>>
I don't like the idea of inheritance.
Sounds like a great way to turn your code into an unmanageable mess.
>>
>>52319147
i'm pretty sure height is genetic
>>
>>52319147
>bitchboy: the post
calories in and calories out, faggot
>>
>>52318972
Americans really fucking disgust me.
>>
>>52319151
Just like in real life.
>>
>>52319151
it's quite a convenient way of implementing DRY tbqh
>>
Implement an ArrayList using a HashMap.
>>
>>52319151
I don't like armchair programmers.
>>
>>52319154
estrogen is what fuses your growth plates. you can give aromatase inhibitors to young manlets and they'll grow tall as fuck

>>52319165
>what is metabolism
>>
File: 1428046310386.jpg (417KB, 2000x1000px) Image search: [Google]
1428046310386.jpg
417KB, 2000x1000px
>>52319151
>people who use OOP for taxonomy and not strictly code reuse when it's applicable
>>
>>52319154
There are other things that affect it. Dad is 6'3, grandfather on mom's side is 6'1, and dad's side is 6'2. I'm 5'8.
>>
>>52319154
1/4 will be notably shorter than the parents, 1/4 will be notably taller, and 1/2 will be around the same height.
Bad nutrition adversely affects growth during adolescence.
Also, just because you eat doesn't mean you get the right kind of nutrients, thus making you potentially fat and anemic.
>>
>>52319147
>from lack of food, but are still overweight

:')
>>
>>52319183
class MyDick implements YourMum {
public Dick pullout()...
}
>>
>>52319188
>OOP for code reuse
>not refactoring everything into tiny functions
Faggot.
>>
>>52319200
You're just a bitch boy.
nothing wrong with it, not everyone was meant to be manly, after all
>>
>>52319151
I agree. I avoid inheritance whenever possible.
>>
>>52319224
I don't even know what that means.
>>
>>52319151
Literally the opposite.
>>
thinking of starting a blog on C development

there's loads of little things that I couldn't find a guide to online and I guess it would be cool to have it out there if someone else needs it
>>
Inheritance tax in C++ is the worst
>>
>>52319151
>Sounds like a great way to turn your code into an unmanageable mess.
Don't be presumptuous anon. Simply because inheritance seems unintuitive at first, doesn't mean it's not really great. I mean.. it's not... and it does turn you code into an unmanageable mess... but you shouldn't presume it, you should at least learn exactly why it's horrible.
>>
>>52319248
Start that shit up
>>
>>52319249
There is none.
>>
why does sepples constantly get shit on for multiple inheritance and operator overloading when python has the exact same features yet is regarded a "clean" language?
>>
>>52319248
Yes
>>
>>52319277
Because nobody writes any substantial software in python, it's not built for it
>>
>>52319277
Because people have no idea what they're talking about.
>>
>>52319248
pls do
give it a nice theme and i'll bookmark it

just dont put it on tumblr
>>
>>52319248
If it looks good then I will read it
>>
>>52319248
You have my support
>>
>>52319277

Meming.

Nice repeating digits, btw.
>>
>>52319296
>>52319278
>>52319260
yeah I think I will

going to go over my notes and git projects to and whack together an initial post.

what platform should I use for the ebin blog? needs to be free, and not have an expiry date or anything and preferably something that programmers might use rather than an SJW fest like twitter or tumblr.
>>
>>52319346
wordpress is the easiest way to go
>>
>>52319346
wordpress

or pay a few bucks a year for a VPS and self-host a wordpress instance with your own domain name.
>>
>>52319346
i think github lets you have your own websites and blogs so long as you put your markdown files in your repos
>>
>>52319277
because python users are retarded
>>
>>52319277
Because everybody already knows Python is shit
>>
Is it poosible to copy paste the ASM output of a C compiler into an inline assembler block of another language to double-dip on C compiler optimization?
>>
>>52319346
See
>>52318624
>>
File: image.png (98KB, 640x1136px) Image search: [Google]
image.png
98KB, 640x1136px
Hi dpt, help an oop newbie , whats the fucking point of abstarct classes if you are going to override them anyways ?
>>
>>52319384
eh, not such a fan. I'd rather not have people see my shitty frontend code (I assume it needs to public for people to see the blog).

>>52319370
>>52319353
cool, wordpress it is

going to to sort it out over the weekend hopefully have something by monday.
>>
>>52319414
Please don't be dumb
>>
>>52319405
gcc -S
>>
>>52319405
>inline assembler block of another language

What language?
>>
>>52319431
No, I mean is it a thing people do, is it practical?
>>52319438
Free Pascal. There are some things that FPC doesn't optimize well, so I was thinking maybe you could do that for performance critical blocks.
>>
>>52319425
interfaces are not abstract classes
>>
>>52319425
because it allows to provide several different implementations to the same problem with a single interface. you can then dynamically choose which soution to use with changing the code that uses it.

this is an example of modular programming
>>
>>52319425
So you know for sure that you can interact with everything that implements it through the same methods
i.e. anything that implements animal can be made to makeSound() and eat()
>>
>>52319456
Yeah, why wouldn't it? gcc literally passes the same shit to to as for assembly.
>>
>>52319425
Inferface != abstract class. An interface is sorta like a header file in C/c++. You can only define function signitures and class member names in an interface. Unlike interfaces, abstract classes can contain some implementation.

An interface defines an interface to a system. Then you can later define multiple different representations of the system, that all work in different ways, but that have the same external appearance to other parts of your program. Say you write an interface for accessing a db in your program, then you make a db interface, and then have seperate classes for each kind of db that all implement your interface. Then you can use the objects in the same way, while they have different internal representations and functionality. Not very useful as one programmer, but on a team it would make it much easier for other programmers to maintain consistency.

You don't override methods from an interface, you actually implement them. Notice how there is no body to them in the interface?

An abstract class is similar, but you can also define some of the implementation. Say you add a custom data formatting method to your db, that will be the same for every variation. You could put this in an abstract class. Downside of abstract classes is you can only inherit from one, wheras you can implement as many interfaces as you want.

Tiny examples like the one linked are shite, go read a good oop book on your language. You will never truly understand oop well from shitty web tuts.
>>
>>52319456
>Free Pascal.

Well, try it out and report back. Seems like an interesting test.

>>52319425

The idea is to have a consistent interface (and I mean in the general sense: how you interact with them) for things. Abstract classes give you partial implementation, and interfaces give you none.
>>
>>52319521
Thanks! I tried looking for one in the wiki but its down and i just remembered dpt exist
>>
File: Image084.jpg (114KB, 1024x768px) Image search: [Google]
Image084.jpg
114KB, 1024x768px
How can I achieve gainful employment as a developer without having to leave my room?
>>
>>52319745
>how can I kill my back sitting on the sofa
>>
>>52319745
Happy birthday Anon
>>
>>52319248
I'll make the logo
>>
>>52319745
nice fuarked up spine you've got there brother
>>
If I define an enum type inside of a struct, is the scope of those enum identifiers limited only to functions where I initialize a struct object, or is it global?
>>
>>52319248
One semester i had to work with old as fuck microprocessors (16F877A) and had the worst time with c for big proyects with lcds and shit , i also realized how some times is hard to find good C on the web
>>
>>52319809
that could be cool

>>52319902
yeah, it's shit like that. I had a similiar experience when I was doing NFC programming for my uni project.
>>
>>52319864
You can use the identifiers anywhere.
>>
>>52315763
What's the point of using that language, honestly? Or is it just for fun. Looks complicated and weird as hell for no reason
>>
>>52320003
Since a lot of people seem to like making Brainfuck interpreters, I would assume that making a Brainfuck Interpreter would be the FizzBuzz of compilers.
>>
>>52320095
Pretty much. It's a minimal turing-complete language with an easy syntax.
>>
>>52320095
It is
>>
File: yt.png (328KB, 640x360px) Image search: [Google]
yt.png
328KB, 640x360px
What would be a good way to convert an md5 hash to a filename friendly alternative?

I need to give my files an md5 hash filename but some of the characters conflict with the OS, like '/', for example.
>>
>>52320121
I don't see why an md5 hash would cause filename issues? The character set is limited from 0-9a-f.
>>
>>52320121
md5 should output hex, why are you getting /'s?
>>
>>52320179
>>52320121
Is it in Base64 or base85? Convert that shit to hex, then you have a good filename.
>>
NEW THREAD

>>52320216
>>52320216
>>
>>52320219
Dumbass
>>
>>52320247
4 away from the bump limit is acceptable.
>>
>>52320305
>4
>being this much of a new fag
>>
>>52320305
>being this retarded
>>
>>52318239
10k lines of not complete shit is a good start.
>>
Have you got an email from source{d} with a job offer? Don't know if it's a scam or the program they use to analyze github repos is broken. Got one as an android UX/UI developer but I have nothing to indicate that on my repository.
>>
I want a project to practice on, but I also don't want to feel like I'm wasting time making something that's already been done a million times. Anyone have any practical ideas?
>>
>>52321434
I am having the exact same problem. Learned Python, but do not have a unique project idea.
>>
>>52321434
Open source windows video editor that's actually usable and worth a damn.
>>
>>52321453
>>52321434
>unique project ideas
>existing when there are 2bn faggots on the planet with computer
>>
>>52321434
Write an usable builder, something with dependency autodetection and project type detection. As versatile as Gradle, but requiring less configuration. Works great for a single project, but when you have multiple related projects you waste a lot of time. You have define the plugin/s for each project, custom plugin options, release types and flavors.
>>
>>52321578
First write a crappy one, supporting just simple projects of your liking. Then refine the api to make it compatible with any kind of project. Ask the user to the define the entry point of the application, and from there scan dependencies to find out what type of project it is. You will have to put the detection logic outside of the api as a plugin, that way people could collaborate writing the detection for each language and library of their liking. If you are going to use python, take in mind in the future you will have to use a threading library to evade the GIL and support parallel builds.
>>
>>52320121
Stop using a shit OS.
>>
How can I check how often a server is updated? I know it's between 100 ms and 600 ms

the problem is when I call it sometimes it double-logs information if I check for too long and sometimes it doesn't update during the interval check

do I just have to make the interval too long or sterilize the data or is there a way to be more precise?

This is in javascript btw
>>
>>52318929
unichode creators attempt to fill space
>>
>>52317081
>Does not, because no memory is used by preprocessor expansion.
Sure, but using USD_TO_JPY anywhere in the code will obviously use memory just like the variable.
Thread posts: 312
Thread images: 21


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

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.