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

File: dpt programming club.png (890KB, 1550x1123px) Image search: [Google]
dpt programming club.png
890KB, 1550x1123px
old thread: >>61541697

What are you working on, /g/?
>>
File: 1496020714139.jpg (1MB, 960x1280px) Image search: [Google]
1496020714139.jpg
1MB, 960x1280px
First for (((Rust)))
>>
fist for Rust
>>
rewriting ms paint
>>
What's the most dudebro language?
>>
Rate my C++ compatible C code!

int
class(new, delete, operator)
{
char *a = malloc(0);
return (new + delete) * operator;
}
>>
>>61547070
fortran
>>
File: eo5u.png (273KB, 1550x1123px) Image search: [Google]
eo5u.png
273KB, 1550x1123px
>>61547024
your png has been optimized
>>
>>61547119
get it under 30kb
>>
>>61547129
> 1550x1123
> under 30kb
do you know how pixels work, son?
>>
>>61547145
pajeet could do it...
>>
Why is C++ so shit compared to rust?
>Compiling rust is just cargo build.
>Compiling C++ I have to write complicated make files and shit.
Why can't it just be simple? I want to write code. Not have to worry about a goddamn build system.
>>
File: that shirt.jpg (176KB, 750x1000px) Image search: [Google]
that shirt.jpg
176KB, 750x1000px
I just used arrays for the first time and you can fucking bet that I'm very proud of myself right now.
>>
Does anybody have a good resource on writing a markov chain?
The only shit I can find are WRITE YOUR OWN DISCORD/TWITTER/IRC MARKOV BOT IN PYTHON IN FIVE EASY STEPS! and its just
>first you'll need to import this library!

Not interesting in importing somebody elses shit.
>>
>>61547248
because it's antiquated shit
>>
>>61547248
C++ doesn't have a standard dependency management system, the language is 30 years old
>>
>>61547266
what for
>>
>>61547248
Microsoft Visual Studio users don't face problems like you mentioned in your post.
>>
>>61547268
http://agiliq.com/blog/2009/06/generating-pseudo-random-text-with-markov-chains-u/
>>
>day
>can't write shit
>drooling in the office like a retard
>night
>productive as hell
fuck
>>
>>61547277
No wonder, C++ is meant for MSVS
>>
>>61547285
>import markovgen
what did I JUST say
>>
>>61547273
Literally why not? No one has had time in 30 years to fix this?

>>61547277
>Must use propreitary software to even code in your language.

My rust workflow is literally git + vim + cargo. Why hasn't someone made a sane solution for this yet?
>>
>>61547277
it has a windows problem which is arguably worse than makeshit
>>
>>61547303
>Literally why not?
Lack of vision, if you look at C++ this becomes apparent
>>
>>61547248
>Rust shilling this late in the day
I can't wait until Mozilla goes belly up

I can compile C++ code with literally two key presses.

http://bazel.io
>>
>>61547273
Even >padjeet java has maven central. How is the language this far behind?
>>
>>61547248
Because Rust was designed to overcome C++ shortcomings
>>
>>61547326
That would be D not rust
>>
>>61547317
Rust has a shittonne of warts but the build system is simple enough for me, a goddamn brainlet, to be able to use.
>>
>>61547317
Nice 3rd party tool you got there
>>
>>61547333
I love D, the only reason I left D is because of the STW GC
>>
>>61547317
>I still have to write a makefile. Its just in our DSL.
Why?
>>
>>61547326
Rust was designed for pink haired psychopaths like the transperson who cucked you to take over system programming. :^)

It's hilarious how people need their hands held to compile shit now. There's a billion build utilities for C++ and all the shills in here think cargo[cult] is somehow an exception.
>>
>>61547317
rust can live just fine without mozilla at this point desu
>>
>>61547356
>Rust was designed for pink haired psychopaths
Very rude
>>
>implying makefiles don't give you flexibility much needed in an actual professional environment
>>
>>61547344
>3rd party
The C++ standard doesn't specify the build system because there are literally hundreds of environments that use C++, unlike Rust. Enjoy your 100MB executables.
>>
>>61547352
GC.disable();
>>
>>61547356
I could spend time and learn a build system sure. But why should I have to? Building my code should be the last thing I have to worry about.
>>
>>61547369
>The C++ standard doesn't specify the build system because
It has no vision
> Enjoy your 100MB executables.
Educate yourself
https://stackoverflow.com/questions/1993390/static-linking-vs-dynamic-linking
>>
>>61547372
>No BigInt
>>
>>61547353
Because unlike Rust, you don't need to implement stupid analysers just to recompile each time in C++. The first compile takes the longest and then it's just module compile and link time optimisation. It's what makes C++ faster than rust among other reasons like a much more expressive template system.
>>
>>61547024
Writing a shitty encrypted one on one chat application. It works but I'm not proud of it in the slightest
>>
>>61547391
https://dlang.org/phobos/std_bigint.html
>>
>>61547356
>/pol/tards shit on static type checking and helpful compiler messages now because of unrelated politics
how brainwashed can you be
>>
>2017
>Writing header files
Dropped
>>
File: sancutie.jpg (47KB, 430x530px) Image search: [Google]
sancutie.jpg
47KB, 430x530px
>>61547356
>creates another build system to avoid autotools
heh
>>
>>61547375
Why did you waste your time learning rust? You realise Mozilla is the only thing keeping it around and Firefox will soon be dead, right?
>>
>>61547397
BigInts require GC
>>
>>61547395
what is it for?

personal project?
>>
>>61547068
from last thread.
I'm making a site that sends requsts to a server,
then displays the result on the site.
that simple.
What should i use/do?
>>
>>61547392
That doesn't explain why I need to write a make file
>>
>>61547385
>bawww we have to statically link everything because of the patriarchy
>>
>>61547405
Yes, Servo is the future. It's the most GPU aware web renderer to date.

It's like MPV for web browsers
>>
>>61547405
>be me
>using firefox
>goto about:addons
>ublock origin detected something
>google analytics
>>
>>61547405
I don't give a shit about the language. I already know it. I'm trying to learn C++ and I can't even setup a minimal build environment without booting up fucking visual studio
>>
>>61547416
Is that supposed to be a counter argument?
>>
>>61547398
>unrelated politics
Remove the CoC from your ass and wake up already. Rust is being artificially propped up. If this type system is such a revolution why didn't Ada take off?
>>
>>61547416
Comments like these is why no one takes /dpt/ seriously
>>
>>61547406
btw, new compiler out today

https://dlang.org/blog/2017/07/24/new-d-compiler-release-dmd-2-075-0/
>>
>>61547446
I hear it finally deprecated some old string operations.
>>
>61547408
Yeah I was just curious how hard it would be to make a socket based chat application from "scratch". The answer is not that hard, but somewhat annoying
>>
>>61547438
if anyone took /dpt/ seriously, this place would be infested

thank god
>>
>>61547428
Did you try reading up on gnu make? How about cmake? Pick one and invest like an hour and you'll never have to think about it again.

I have one make file that's general enough that I just need to add the necessarily library paths to, but I've since moved on to bazel. The only bad part about the latter is it needs java but adding dependencies literally takes a single line per file.
>>
>>61547455
>this place would be infested
it isn't?
>>
>>61547408

See >>61547454
>>
>>61547409
spark framework
>>
>>61547268
Just read the wikipedia article, it gave me enough information to write a C# library for it.
>>
>>61547248

> He thinks software is only about writing code.

Enjoy your bloated deploy.
>>
>>61547464
not really
>>
>>61547476
you're right, it's about meetings too
>>
Can a program recompile itself during execution?
>>
>>61547507
Is the language interpreted?
>>
>>61547476
Why shouldn't it be? I'm not writing some mission critical software here. I'm just trying to build a goddamn hello world. If I needed the most minimal install I could, I would spend the extra time to fine tune it. But I don't. No one on this goddamn website runs shit that actually matters.
>>
>>61547509
i don't know. do you want it to be?
>>
>>61547507
if you mean JIT compilation, yes, in some languages
if you mean rewriting the file, recompiling, running the new executable, then passing stuff over to the new executable, also yes, although you need to do all that manually
>>
>>61547507
during execution like Hotspot JVM, or more compiled than that?
>>
>>61547534
>>61547529
>>61547509
this just a random thought in my head
>>
>>61547550
imagine the performance hit
>>
>>61547409
my.php
<?php
$myPDO = new PDO('mysql:host=localhost;dbname=dbname', 'username', 'password');
$result = $myPDO->query("SELECT data FROM datas");

print $result;
?>


Ajax -> my.php and you're golden
>>
>>61547512

It's a bad pratice. Lot of bullshit would be gladly removed from the "writing code" phase if some developers actually gave attention to another areas of software engineering. Manual build of software enables fine control of what libraries are linked, when and the flags. It's useful and necessary.

Freedom is more important than retarded abstraction everywhere to enable lazy cunts like you. So, shut up and fucking read an autotools or cmake book.
>>
>>61547507
yes.

Lisp does this quite well.
>>
File: 1500099183861.png (25KB, 1224x183px) Image search: [Google]
1500099183861.png
25KB, 1224x183px
>>61547317
>>61547356
>>61547369
>>61547416
>>61547435
Cringe
>>61547392
Rustc already has delta patches
>>
>>61547579
Meh, I'll just program in languages that do that work for me. I'm not writing code that matters. If you want to waste your life setting up a build system for a toy project, knock yourself out.
>>
>>61547594
>I'm not writing code that matters
so why the fuck are you even doing this
>>
>>61547579
Fucking this. Rust babies need to stfu and let the adults in the room talk.
>>
>>61547435
LOL if you think Ada has Rust's type system you are severely delusional.

Neverless it will still be hard to say where Rust wil be in a few years. It's definitely being over-hyped by Reddit and friends
>>
>>61547592
>uses /pol/ boogieman to contain discussion.
Fuck off back to your CoC enforced community
>>
>>61547556
Yeah, imagine the performance hit if you could easily emit compiled code for a regular expression...

Metaprogramming is a prerequisite for performance anon.
>>
>>61547602
Why not? I have fun writing code. Configuring a build system isn't fun.
>>
>>61547621
4chan has a CoC
>>
>>61547603
You browse a chinese cartoon imageboard. You're a manchild at best.
>>
>>61547640
4chan has a lot of Cocs
>>
>>61547618
It's in the same affine family of type systems.

And yes it's being shilled to high heaven by reddit, it's hilarious they think it will make incompetent programmers compete with professionals.

It will never be adopted and it will never achieve its aims thankfully.
>>
>>61547658
>>>/global/rules/
>>
>wakeup
>there is a rust war going on dee pee tee
Fill me in, whos winning? Guys can't read autotools manual? Cargo is the shit?
>>
>>61547631
you only have to write your build script once
Here's a nice simple makefile that compiles C and C++ objects into one binary
makefiles don't get much more complicated than this unless your needs are also complicated

# C/C++ mixed object makefile
CC=gcc
CFLAGS=-s -ansi -O2
DEBUG=-g -Wall -Wextra
LDFLAGS=-lm -lstdc++

SRC=src
INC=include
OBJ=obj
EXT=c cc cxx cpp c++ C
INPUT=$(wildcard $(patsubst %,$(SRC)/*.%, $(EXT)))
OBJECT=$(patsubst %,$(OBJ)/%.o, $(notdir $(basename $(INPUT))))
OUTPUT=test

.PHONY: all clean

all: $(OUTPUT)

$(OUTPUT): $(OBJECT)
$(CC) $(CFLAGS) -o $(OUTPUT) $(OBJECT) $(LDFLAGS)

$(OBJ)/%.o: $(SRC)/%.* $(wildcard $(INC)/*.h)
@mkdir -p $(OBJ)
$(CC) $(CFLAGS) $(DEBUG) -I$(INC) -o $@ -c $<
clean:
rm -rf $(OUTPUT) $(OBJ)/
>>
>>61547594
>>61547631
C++'s build system is definitely shit. There's no doubt about that, but there are other reasons that C++ is useful. If you want to just whine, that's fine by me, but here's my CMakeLists.txt for an SFML project I'm making (speaking of things Rust doesn't have that C++ does.... SFML or a similarly pleasant graphics library)

# cmake options
cmake_minimum_required(VERSION 2.6)

# project
project(otcg)
set(otcg_VERSION_MAJ 0)
set(octg_VERSION_MIN 1)

# external libraries
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake-modules/")
find_package( SFML 2.3 REQUIRED COMPONENTS graphics window system )

# sources
set(SOURCE_PATH "${PROJECT_SOURCE_DIR}/src")
file(GLOB_RECURSE SOURCES_GLOB
"${PROJECT_SOURCE_DIR}/src/*.h"
"${PROJECT_SOURCE_DIR}/src/*.cpp")

set(SOURCES ${SOURCES_GLOB})

# compiler
set(CMAKE_CXX_FLAGS "-std=c++17 -Wall -Wextra ${CMAKE_CXX_FLAGS}")

# executable
add_executable(otcg ${SOURCES})
target_link_libraries(otcg ${SFML_LIBRARIES} ${SFML_DEPENDENCIES} ${OPENGL_gl_LIBRARY})
>>
>>61547085

>parameters without explicit type names
>Initializing variables without using them
>>
>>61547669
>autism
>>
>>61547666
?
>>
>>61547666
<hint: that's not a CoC>

Nice try
>>
>>61547703
It is, with different names, global rules dictates how you interact with 4chan and it's users
>>
>>61547398
>reddit faggots are shilling Rust's inferior type system because they can't comprehend a master-race type system built on sequent calculus
>>
>>61547675
I'm not saying that C++ isn't useful. However, I want to learn the language, not the build system. It seems like a clusterfuck of hacked together cludge. How and where do I find libraries? Do I literally have to copy the source manually / git clone?
>>
>>61547679
There's nothing autistic about an automated makefile that requires no editing ever.
>>
>>61547725
> an automated makefile that requires no editing ever.
Sign me up
>>
File: 1498108612020.webm (924KB, 600x336px) Image search: [Google]
1498108612020.webm
924KB, 600x336px
>>
>>61547717
le reddit xddd
>>
>>61547725
As opposed to:

[package]
name = "foobar"
version = "0.1.0"
authors = ["foobar <[email protected]>"]

[lib]
crate-type = ["cdylib"]

[dependencies]
lua = "*"
libc = "*"
>>
>>61547719
>How and where do I find libraries
google

>Do I literally have to copy the source manually / git clone?
or
your-pkg-manager-install-command lib-anon-is-retarded-dev
>>
>>61547717
>I got told so I'll just meme my way out of it and throw in reddit for good measure
classic
>>
>>61547751
>Windows development.
>>
>>61547679
Maybe programming isn't for you if you consider that standard makefile autism

Do you see this retard, gentlemen? This is what Rust produces. May god have mercy on us.
>>
>>61547751
>lib-anon-is-retarded-dev not found in the repository
>enjoy 4 hours of hunting down deps and solving the dep hell
>>
>>61547719
You usually install the package from source `... make install` or through your system package manager and it grabs header files from /usr/include and links with shared objects in /usr/lib. My CMakeLists has stuff there for linking with SFML, I figured out how to set that up with a few google searches.
You usually don't bring in as many dependencies in C++ as you do in Rust / Python / JS. Usually something like a graphical library plus boost if you're feeling like bloating up your project, is enough.

>>61547749
Rust was designed with the benefit of hindsight, nobody is disputing that it's easier to set up a Rust project than C++.
>>
>>61547773
Makefiles are not programming
>>
>>61547714
>any rule is a CoC
That's not how it works you little shit
>>
>my type system is so shitty that it literally can't be defended
Your typical rust user, ladies and gentlemen.
>>
File: arbitrarily-shaped-blocks.png (87KB, 831x658px) Image search: [Google]
arbitrarily-shaped-blocks.png
87KB, 831x658px
>>61547024
Adding support for arbitrarily shaped blocks to my minecraft clone. What you see here is a bit of a hack. I hardcoded some inputs to the rendering object sorting algorithm. Now to un-hardcode them.

I also need to add a loader for model files (probs going to do wavefront object files) so that the vertex data doesn't have to be hardcoded in C.
>>
>>61547791
Which of the rules are not CoC?
>>
>>61547780
Thanks for your input, anon. But it just isn't worth the extra effort for me.
>>
>>61547661
>It's in the same affine family of type systems.
I can't find anything affirming this, and I have been doing a lot of work with linear and affine type systems so I know an affine type system when I see it. Do you have any resources on Ada's type system?

>>61547802
Fair enough. Rust is a lot of fun.
>>
File: 1497988968405.jpg (25KB, 572x720px) Image search: [Google]
1497988968405.jpg
25KB, 572x720px
>>61547669
That shit is autistic as fuck, no joke
>>
>>61547825
Explain why it's autistic without using memes.
>>
If Rust is so good, why does literally no one here run Redox?
>>
>>61547794
Looks nice. Are you going to reskin it at some point or just keep using original textures?
>>
>>61547840
>INPUT=$(wildcard $(patsubst %,$(SRC)/*.%, $(EXT)))
>OBJECT=$(patsubst %,$(OBJ)/%.o, $(notdir $(basename $(INPUT))))
>OUTPUT=test
>.PHONY: all clean
>all: $(OUTPUT)
>$(OUTPUT): $(OBJECT)
> $(CC) $(CFLAGS) -o $(OUTPUT) $(OBJECT) $(LDFLAGS)
>$(OBJ)/%.o: $(SRC)/%.* $(wildcard $(INC)/*.h)
> @mkdir -p $(OBJ)
> $(CC) $(CFLAGS) $(DEBUG) -I$(INC) -o $@ -c $<
>>
>>61547849
?
>>
>>61547849
Do you have a problem with GNU make syntax or are you just being a retard?
This doesn't look any more terse than the C++ code you'd be compiling with it.
Also, you don't have to use capitals for variable names, but I like to do it.
>>
>>61547859
Your makefile also doesn't detect changes in .h files... I use to roll my own makefiles like you but I started using cmake and it saves a lot of hassle. Yes there are probably plenty of reasons why it sucks but which C++ build system doesn't?
>>
>>61547787

Make may be a domain specific language, but it's still Turing complete and can be used to produce programs. It's just that the majority of its uses are programs that describe how to build another program.

http://nullprogram.com/blog/2016/04/30/
>>
>>61547886
Actually, it does.
It just recompiles everything upon any change in the header files, which is fine for smaller projects, you shouldn't be touching your headers unless you made huge sweeping changes anyway.

I know you can get around this with gcc and dependency generation, but this stops being portable with compilers older than gcc 4.6 and non-GNU toolchains.
>>
>>61547897
Is it plausible to use makefiles as a standalone truing complete language?
>>
>>61547909
make*
>>
>>61547848
Definitely going to reskin it. I'm probably going to get someone else to do it for me though because I suck at pixel bullshit.
>>
>>61547849
You have to be mentally challenged to defend this autism
>>
>>61547921
have you never written a shell script?
The syntax is similar.
>>
>>61547248

You don't really need a Makefile for C++ except in more complex projects. Since you mentioned in >>61547512 that you just want to build a goddamn hello world, implying that you are writing a single file program, why not simply invoke the compiler on your program?

g++ -o helloworld helloworld.cpp
./helloworld


Simple as that, no Makefile required. When you need a more complex program, you make a Makefile, just as more complex Rust programs require you to mess around with a cargo.toml file.
>>
>>61547909

Read the link I just posted; it is. The author even posted a Conway's Game of Life in Make.
>>
>>61547929
Of course anon hasn't, that would imply he's ever done something useful.

>im a "systems programmer"
>use rust
>but I can't write a shell script
>don't get a job
>FUCK THE PATRIARCHY
>>
File: old_hag_langs.png (173KB, 600x355px) Image search: [Google]
old_hag_langs.png
173KB, 600x355px
Nobody Likes Pascal.
>>
>>61547929
>>61547975
What is a """"shell script""""?
>>
No matter how difficult it is, if you want to get a job in systems programming, I can't possibly fathom anyone hiring someone who doesn't know how to write/edit makefiles, and refuses to learn C or C++ because it's "too much effort"
>>
>>61548007
Systems programmer use MSVS with C++, writing make files are not important
>>
>>61547975
More importantly, what is a ""systems programmer""?
>>
>>61548003
a script written in shell
>>
>>61548003

It is a script that is run within a shell, such as Bash.

>>61548028

Windows systems programmers use MSVS. You cannot target any platform other than Windows with Microsoft's compiler.
>>
>>61548054
What is a ""script""?
>>
>>61547268
is it not just equivalent to coding a linear algebra library?
>>
>>61548028
I work at a payment processing company and most of our codebase is C++, all designed for windows.
I still wouldnt give a second thought about denying somebody who couldnt use a fucking makefile.
>>
>>61548079
Because you yourself use makefiles so often, right?
>>
>gcc 7 been out for months
>debian unstable still on 6.4

explain this shit, nerds
>>
>>61548066
a text file which is read by an interpreter
>>
>>61548085
>debian
>>
File: dptopt.png (284KB, 1550x1123px) Image search: [Google]
dptopt.png
284KB, 1550x1123px
>>61547119
The native ordered one, also optimized
>>
>>61548086
what's an interpreter?
>>
>>61548086
So like Haskell prelude?
>>
>>61548090
unstable is up to date more often than not
>>
>>61548093

A program that runs other programs.
>>
>>61548084
If I'm hiring somebody to work in seeples or even just unsafe C#, and they don't understand makefiles, it means they havent spent anywhere enough time to know what the fuck they're doing.
>>
>>61548099
what's a program?
>>
>>61548097
>Debian
>Up to date
>>
>[In C] write a function that expands shorthand notations like a-z into equivalent complete list abc...xyz. Handle cases like a-b-c and a-z0-9

Can this be done with a one liner?
>>
>>61548100
>it means they havent spent anywhere enough time to know what the fuck they're doing.
By anywhere you mean MSVS, which your company relies on, right?
>>
>>61548113
>write multi-line code to solve the problem
>remove all newlines and tabs
>>
>>61548107
a proof
>>
Make is deprecated, and so is header files
>>
>>61548121
Ask me how I know you've never had to do extensive programming on windows.
>>
>>61548113
Nothing in C can be done in a one liner unless you like abusing the comma , operator.
And even then the GNU gimple intermediary language rewrites your shit code so the compiler never sees your i-cache busting abomination
>>
>>61548138
Oh how I wish this were true.

>>61548113
Are C one-liners even possible?
Also what is "a-b-c" supposed to expand into?
>>
>>61548141
I don't program on windoze
>>
>>61548137
programs are NOT proofs!
proofs don't do shit.
write me a proof that can edit text
>>
redpill me on MSYS2
>>
>>61548147
And if you started, you wouldn't be coming from the obtuse windows-end of it.
I.E. You would know how to use a fucking makefile.
>>
>>61548153
>>61548138
>>
redpill me on ````smart contracts''''
>>
>>61547024
Turning the buffer in the fetch stage of my processor into a cache.
>>
>>61548161
>Anything that wasnt made in the last 5 years is OLD and nobody needs to know it!
I have a Perl dev who would like to politely disagree with your unbelievably stupid ass.
>>
File: 1498107207388.png (1MB, 991x1426px) Image search: [Google]
1498107207388.png
1MB, 991x1426px
https://github.com/lih/setup
>>
>>61548178
>Perl
Is he alive?
>>
>CS is a meme! Why won't anyone hire me? It's those fucking pajeets taking all of our jobs!
>makefiles are really hard :-(
>>
>>61548188
>CS
>S
>"""S"""
>>
>>61548188
>C"""S"""
>>
File: 1500860656412.gif (3MB, 460x373px) Image search: [Google]
1500860656412.gif
3MB, 460x373px
>>61548186
>It's not Java, Javascript, or Python
>Must not exist!
I legitimately pity you.
Perl isnt even a hard syntax to learn.
>>
File: 23061819.jpg (81KB, 805x768px) Image search: [Google]
23061819.jpg
81KB, 805x768px
What would this look like in c++?
It just generates numbered folders in the directory you run the script.
I feel like I can just start typing and do anything with python, even with spaghetti code. But c++ is intimidating.

import os

howManyFolders = 100
prefix = 'CH'
z = []
w = 0

for i in range (0,howManyFolders + 1):
if i < 10:
z.append(prefix + '0' + str(i))
elif i >= 10:
z.append(prefix + str(i))

os.chdir(os.getcwd())

for x in z:
os.mkdir(z[w])
w += 1
>>
>>61548194
"""C"""
https://www.youtube.com/watch?v=2Op3QLzMgSY
>>
>>61548186
lol
of course it is
>>
File: 1491081808903.jpg (56KB, 945x482px) Image search: [Google]
1491081808903.jpg
56KB, 945x482px
>>61548204
All of them are more alive than Perl, it's just as unpopular as C++ these days
>>
#include <x86/pervasives.h>
>>
>>61548207
Why would you write this in C++ and not as a shell script?

here
for i in $(seq 0 100)
do
mkdir "$i"
done
>>
>>61548220
>The rise in retards who write nothing but JS means there is a strict decline in another language
Learn how a fill-restriction graph works you mongloid
>>
>>61548194
>>61548203
Even very theoretical CS requires getting your artifacts to compile.
E.g. building ocaml files, rendering TeX
>>
>>61548225
mkdir s{0..100}
>>
Not trying to shill but since I've started using D every other language feels inadequate and clunky. I'll be writing something in C++ or Java at work and all I can think about is how it could've been written faster and more concisely in D. I understand now how Lisp programmers must feel... D is the closest I've ever come to feeling like I am expressing the design in my head directly in code without all the programming pattern and language gotcha bullshit. It's like C++ and Python on steroids.
>>
>>61548241
It's like saying stupid shit like social engineer or sandwich artist
>>
Not any of the guys above but this discussion has got me thinking

I copy and paste a wildcard makefile into all my projects, but have only a vague idea of how it works

Could anyone please link me to a tutorial that talks about makefiles in more detail and "best practices" for writing them?
>>
>>61548255
What the fuck do you want me to call it you gigantic autist?
>>
>>61548254
Ex D fag here, D is probably the best programming language to date if you discount the GC

But I can't speak of Lisp or Haskell or Idris etc,
>>
>>61548225
That's just a random example, how hard is it to access the OS with c++, or download things from the internet, upload to FTP servers?

Trying to switch because 'Python is bad' but I can already do every thing I need with it.
>>
>>61548270
Computer Engineer
>>
>>61548266
The GNU make manual is very complete and adequate.
https://www.gnu.org/software/make/manual/make.html
>>
>>61548207
This is the exact kind of task Python should be used for , and the exact opposite kind of task that C++ should be used for.
The C++ solution is gonna be really ugly and involve a bunch of awkward C calls

>>61548296
Computer engineers don't write LaTeX and OCaml
>>
>>61548279
>Ex D fag
I'm guessing you switched to Rust? I've tried it out and it is a pretty nice language but it just doesn't have the same raw power as D. Template metaprogramming and CTFE are like a drug.
>>
>>61548298
Thank you, will read
>>
>>61548312
I agree, D is good where it counts: it's comfy
>>
>>61548285
For scripts, python, bash, any scripting language is fine, you're just cobbling together other people's programs to do useful work without writing a new program.
You shouldn't try to write a one-off downloader script in C++ unless your needs are much more advanced than whatever the curl program can do.
Curl is literally just a shell front-end for the libcurl library which you can fully utilize in your C programs.
>>
>>61548312
>I'm guessing you switched to Rust
Nah, i'm using code by drag and drop now.

so tired of programming.
>>
Guys, I'm 23 and my whole life I thought I wanted to be a lawyer but the only joy I've ever had doing real work involved dicking around with coding.

Experience-wise, I got nothing. Just dicking around. But I think about my future and my debt if I go two more years of school and writing memos for stuck up assholes forever and it makes me want to kill myself. Is there any hope at all for someone as old as me to drop everything and practice coding every free moment I have and possibly make a career out of it? I don't care about money anymore, I want to be happy.
>>
>>61548312
Also, look for a guy called Stephan Koch, if you have any questions regarding CTFE you should ask him.

I think in freenode, he goes as uplink | DMD (not sure)
>>
>>61548311
>Computer engineers don't write LaTeX and OCaml
Anecdotal confirmation. I don't even know what those are.
>>
>>61548357
hi jack stouffer. still lurking g I see. don't you have some pull requests to review?
>>
>>61548107

A sequence of instructions to be executed by a computer.
>>
>>61548368
Electrical engineer
Haven't used them at work, but often for classes
>>
>>61548389
lol nope, I'm not him.
I'm to intelligent to be productive
>>
>>61548351
I can't give you career-path advice, but you're only 23, you have a lot of time to become competent in any field.

If you code in all your free time and have something to show for it, I'm sure someone will hire you fast provided you get through the HR filters. Even if they don't, coding in your free time sure beats wasting away in front of the TV.
>>
>>61548351
>knows what makes him happy
>guys should I do it?
If you give up because of your age, you weren't gonna make it anyway
>>
>>61548413
>If you give up because of your age, you weren't gonna make it anyway
I've been busy with other stuff, it took until now to realize that other stuff didn't make me happy.
>>
>>61548428
what stuff?
>>
>>61548453
Undergraduate internships/study and law school stuff
>>
>>61548357
Also, ask questions on #d

There are some really smart people on the channel

Ketmar, alphaglosigned, adam_d_ruppe, B4SILE, Zaydec, uplink etc will help. Good luck!
>>
>>61548463
what about pussy?
>>
>>61548482
I don't struggle with girls, that wasn't my question.
>>
>>61548492
what about boipucci?
>>
>>61547294
This, very much this.

You found a cure yet? AM caffeine seems to help me, but afternoon I'm out. After 7pm and I'm at 120% efficiency. Wish switching sleep schedule was healthy.
>>
>>61548475
>ketmar
Guy's a troll but also one smart motherfucker. I get a laugh out of some of his newsgroup posts.
>>
File: C5twiR3UwAAbuuM.jpg (356KB, 2048x2048px) Image search: [Google]
C5twiR3UwAAbuuM.jpg
356KB, 2048x2048px
>>61548351
>throw the fuck away everything I worked for because I like writing fizzbuzz more than studying law
Idk, anon, aint lawyer thing worth powering through and be, like, on top of the world later in life while coding games on your weekends for fun? Are you absolutely sure you aren't just lazy atm and don't want to study?

As for age, it means dick.
>Someone as old as me to drop everything and practice coding every free moment I have and possibly make a career out of it
Sure
>practice coding every free moment
that's the bloody hard part though, can you actually do it?
professional programming is not "fun" 24/7
>>
>>61548532
ketmar is very knowledgable
But there are people on the forum that are monsters. Like Andrei
>>
>>61547294
Feels good to be an early bird. Though it fucks with you by the afternoon already.
>>
>>61548528
>You found a cure yet?
Kinda. Managed to convince my lead that I can show up at 3-4 p.m. at the office when there are no big meetings planned
>>
>>61548572
don't you dare talk shit about my handsome slav husbando
>>
>>61548528
>>61547294
You know what would help a lot?
If your daily exercise consisted of more than simply walking to and from your car every day.
>>
>>61548633
I dance a lot, so that's not the case for me at least
>>
File: 2024614.jpg (47KB, 640x960px) Image search: [Google]
2024614.jpg
47KB, 640x960px
D is THICC
>>
File: 1495346419929-fit.jpg (286KB, 960x1200px) Image search: [Google]
1495346419929-fit.jpg
286KB, 960x1200px
>>61548672
That's a fat piggu
This is T H I C C
>>
>>61548672
D is a thick woman
Rust is a skinny trap
C++ is a fat granny
C is a spirit
>>
>>61547145
Yeah, but it's 1550x1123 pixels of relatively contiguous black and white.
Can it be done? probably. Is it worth the time? probably not.
>>
>>61548692
>short hair on a busty chick
shit taste desu
>>
>>61548225
>>61548250
btfo
>>61548285
scripting languages exist for a reason. making a C++ program to create 100 directories from 1 to 100 is dumb. not hard, just dumb. you can use the system command
#include <stdio.h>
#include <stdlib.h>
void main(){
int i;
char command[50];
for(i = 0; i < 5; i++){
sprintf(command, "mkdir %d", i);
system(command);
}
return;
}

gross
>>
File: huffman.png (861KB, 798x1154px) Image search: [Google]
huffman.png
861KB, 798x1154px
>>61548721
It could possibly be done, but only by lossy png compression algorithms that group chunks of really similar pixels into the same color. Right now there's some jpeg artifacts in that png that are being losslessly encoded (I know because I made it)

Captcha was extremely relevant this time
>>
>>61548921
Are you being fucking serious?
You're not even going to use linux filesystem headers?
>>
>>61548953

And limit the program to only run on Linux?
>>
>>61548921
>not including unistd.h and using mkdir()
>>
Insufferable motherfuckers
>>
>>61548207
In C++17:
#include <filesystem>

int main(void)
{
static const std::string prefix = "CH";
for (int i = 0; i < 100; ++i)
{
std::filesystem::create_directory(prefix + std::string(i < 10 ? "0" : "") + std::to_string(i));
}
}
>>
>>61549011

mkdir() is a part of sys/stat.h, not unistd.h
>>
>>61549030
redpill me on unistd.h vs stdio.h
>>
>>61549037

unistd.h is a system header mandated on all POSIX systems. You use it for MOST Unix-related system calls, like read(), write(), open(), etc...

stdio.h is a header that is part of the C standard and required for all non-freestanding implementations. It is more portable, and includes functions like printf, fopen, fputs, fgets, etc...

If you just need console/file I/O, use stdio.h's functions
If you need access to low level Unix functions, use unistd.h.

Be aware that not all syscalls are in unistd.h. Some are in headers under the sys/ directory.
>>
>>61548312
I'm also an ex-Dfag that's thinking of returning. I still love the language, but is there any good reason to use it over the more popular and similar C#? I like D's syntax a bit more (mostly because I used it first) but C# seems to beat it hands down in usage and support.
>>
>>61549104
That makes a lot of sense, thank you

>not all syscalls are in unistd.h. Some are in headers under the sys/ directory
Were the syscalls divided up in logical ways? Why even split them up in the first place?
>>
>>61549127
I'm not sure what ruby is on about. No syscalls are in unistd: they're in sys/syscall.h.

You call them with "syscall(syscall_id, ...)"
>>
File: 1499486904283.gif (577KB, 540x540px) Image search: [Google]
1499486904283.gif
577KB, 540x540px
>>61549023
use std::fs;

fn main(){
for i in 0 .. 100 {
fs::create_dir(format!("CH{:02}", i));
}
}
>>
How would I pull the chat from a game client and then break it down to its plain text version? I want to run it through a filter and get notifications when one of the filtered items is detected? I have captured the packets using wire shark but am not sure how to proceed.
>>
>>61547424
>GPU aware web renderer
Remind me why this is a good thing?

I'd rather not my browser link against some easily exploitable driver blob that runs half in the kernel
>>
what was your first "big" project that increased your programming skills significantly? personal or school related, doesn't matter
>>
>>61549155
This is where Rust's safety precaution comes into place
>>
>>61549151
Another day, another episode of c pee pee getting BTFO
>>
>>61549151
Rust wins again!
>>
>>61549168
>rust prevents you from driver bugs in your opengl implementation
This is what rust fanatics ACTUALLY believe
>>
>>61549176
I think it's unfair for C++, the language is old. And it has the disadvantage of "shooting first"
>>
>>61549188
Let's see what happens, shall we
>>
>>61549149

If you call a function in unistd.h, it's going to invoke an equivalent syscall. This is what I'm referring to.
>>
>>61549189
I thought C++17 is supposed to bring unicorn tears to C++?
>>
>>61549211
Yeah we've been hearing this since the C++11 days
>>
Why does everyone hate C++? I mean from C fags to Haskell fags, D fags to Python fags, literally everyone
>>
>>61549319
C++ killed programming
>>
>>61549319
Because it's not very good
>>
>>61549319
>Why does everyone hate C++?
Maybe because it's fucking shit?
>D fags
Literally no such entity exists.
>>
>>61549319
http://harmful.cat-v.org/software/c++/
>>
>>61549358
>Oldfag tier shitposting
>>
>>61549358
>“It took 69 single steps to get past a BOOST_FOREACH() statement. Madness.” – John Carmack

>“Saw comment // NEW BOOST CODE, and had a moment of panic before realizing it was vehicle boost, not C++ boost.” – John Carmack

keke
>>
File: consider.png (445KB, 807x700px) Image search: [Google]
consider.png
445KB, 807x700px
>post your unpopular programming opinions

• There is only three programming languages that I like: C, Go and Ruby.

• I think that strong static typing is a meme and it is really an illusion of safety. Why do languages like Java, C++ and C# have exceptions like ClassCastException? I never run into any typing issues.

• If you design a language for retards, only retards are going to use it. I rather have a powerful language that is like a swiss army knife, I may accidentally cut myself but it is better than a plastic spoon. That's why languages like Java are shit because it automatically assumes you're a retard.
>>
If your language is made for humans, humans are going to use it
>>
>>61549497
This
>>
>>61549482
>Go
>Ruby
>>
>>61549482
You do realise that Go was literally designed for idiots?
>>
File: 20246169.jpg (124KB, 712x915px) Image search: [Google]
20246169.jpg
124KB, 712x915px
Memory safety will kill C++
>>
>>61549530
dumb frogposter
>>
>>61549319
Because of C++ programmers
>>
>>61549482
>Why do languages like Java, C++
These both have really shitty subvertible type systems, rampant null, and other problems (ESPECIALLY C++). They are not good examples of languages with type systems that provide decent guaruntees.
See instead: Haskell, OCaml

>>61549530
What does this mean
>>
>>61549528
i'm sure you're much more intelligent than the average google employee
>>
>>61549583
Probably.
>>
>>61549570
This means:
1. Low level programmers can use C, which is a sane, precise and well defined language
2. C++ provides high level features at (almost) no cost to the high level programmers, which is why it became popular in the first place.
3. What you have to attain by using sanitizers, static analysis, and hundreds of hours of looking for that mutable variable you mistakenly made you can achieve them with Rust, with little or no effort.
4. Rust also has (almost) zero cost high level abstractions, and it has good PL theory behind it, which has evolved since the C++ days.
>>
>>61549482
I prefer assembly to object orientated programming languages.
>>
>>61549616
But anon, Rust won't let me throw pointers around at will like I can do in my C fizzbuzz programs!
Also something something CoC something something Ada
>>
>>61549647
Haskell will
>>
>>61549647
It's just a few rampant shitposters, they are available everywhere, especially in anon image boards because that's where you can act childish without being identified (publicly).

They are welcome no where.
This happened last year: https://forum.nim-lang.org/t/2687
>>
>>61549616
Exactly this. People don't use C++ because it is a "good" language. People use it because it provides a tonne high level features while providing a high performance. I never really understood the purpose of what Rust is trying to do, because it lacks the high level features that C++. Also, strong static typing is like wearing a crash helmet while driving a car.
>>
I am trying to send an audio file to a phone line but the phone line stop receiving the audio after a few seconds, anyone knows why?

here's my program

https://pastebin.com/9DvWTK0Z
>>
>>61549714
>People don't use C++ because it is a "good" language
we already know this
>>
>>61549647

You can do whatever you want with pointers in Rust. It's just going to be more verbose, and likely require the use of the unsafe keyword.
>>
>>61549771
Imagine if you had to say "unsafe" every time you had sex
>>
>>61549780
You would never need to use unsafe at all then.
>>
>>61549789
because unlike ruby, i'm not a girl?
>>
File: trig.jpg (136KB, 850x616px) Image search: [Google]
trig.jpg
136KB, 850x616px
>>61548921
> void main
>>
>>61549780

Well, that would probably be a turn off, though I can think of more verbose things to say that I wouldn't mind using every time I have sex.

>>61549798

1. I'm not a girl
2. Are you under the impression that women have a difficult time getting laid?
>>
>>61549889
No, I'm under the impression that sex is safer for males
>>
>>61549893

And how certain are you of that? What risks do you see that each party takes that leads to men having a more favorable outcome?
>>
>>61549879
seppleslet detected
>>61549939
Not him but the chance of a man catching an STD per fuck is waaaaaay lower, because more man juice goes into the woman than woman juice going into the man.
>>
>>61549319
Compared to most other languages, c++ is simply not enjoyable to write in.
>>
>>61549939
Death during childbirth, disease, etc
Life is safer for women but sex isn't
>>
>>61549953

Ah. Then perhaps you should consider the risks each party takes in the event of a pregnancy.
>>
>>61549939
>>61549962
Not that anything needs changing.
>>
>>61549965
Oh another reason why std rates are higher in women than in men is because vaginal lubrication is literally blood plasma that leaks out of little intracellular holes (+ some other secretions from mucous tissues).

Whereas a man's penis has actual skin. The only point of entry is the dickhole, instead of the whole fucking genital.
>>
>>61549992
men are extremely vulnerable to STDs if you go in the back, there's a reason suppositories work so well
>>
>>61550005
You're not supposed to go into the back you fucking idiot
>>
>>61550037
you're also vulnerable to STDs by getting sprayed with infected fluids into any of your orifices
>>
>>61550056
Try being less of a faggot
>>
>>61550075
straight people have STDs too
>>
>>61550092
No shit, but faggots spread STDs more than anyone else. Many of them even fetishise it.
They're freaks and shouldn't be allowed.
>>
File: 000029-Twitch.png (12KB, 81x58px) Image search: [Google]
000029-Twitch.png
12KB, 81x58px
what is going on right now
>>
NEW THREAD!!

>>61550100
>>61550100
>>
>>61550056

i.e. while eating a girl out?
>>
>>61550103

A discussion about Rust's unsafe keyword turned into a discussion about sexually transmitted diseases.
>>
File: 000025-Twitch.png (17KB, 75x86px) Image search: [Google]
000025-Twitch.png
17KB, 75x86px
>>61550119
>>
Pretty amped, I wrote my first BUT4 in python.
>>
>>61548614
I was thinking about shifting my schedule like that.

>>61548633
Low weight class power lifter here. Pls try again.
>>
>>61549583
The average Google employee doesn't use Go.
>>
>>61547570
>>61547471
thank you both
>>
>>61549482

I enjoy writing Javascript.
The idea that the tech industry could ever be 50% women is a bad joke.
FP is far superior to OOP and the only reason OOP still exists is because the Universities are 30 years behind the industry.
>>
>>61547323
C++ was never intended to be a programming language, it's a researcher's ever unfinished toy language
Thread posts: 322
Thread images: 28


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

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


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