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

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

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

What are you working on, /g/?
>>
File: nixos.png (5 KB, 239x80) Image search: [Google]
nixos.png
5 KB, 239x80
>>54806107
Still working with NixOS, it is still so enchanting. I pity maintainers in non-nix based distributions SO INTENSELY!

That's weird at first: to build a package, you have to evaluate an expression in the Nix language - hence it's programming -. This gives you a derivation, the self-contained instructions for performing a build. Then everything moves to a sealed build environment, compilation occurs there, and you get a symlink back. Results that aren't linked can be garbage-collected, just like in every decent programming language. Also it's non-strict.

Just for fun, I let many revisions of a derivation compile in parallel (their results can coexist, which is such an essential need), and I noticed something weird and cool: when two processes have a common dependency, the first one to get to building it puts a lock to signal that fact, and the other simply waits on it! That's just such a proof of good design, such a shining example of how using good theory leads to good programs...

No really: TRY NIXOS ANONS.
>>
I've been sucking a lot of cock lately.

t. web developer
>>
>static typing means good type safety
haha
>>
File: nixos.png (5 KB, 239x80) Image search: [Google]
nixos.png
5 KB, 239x80
Still working with NixOS, it is still so enchanting. I pity maintainers in non-nix based distributions SO INTENSELY!

That's weird at first: to build a package, you have to evaluate an expression in the Nix language - hence it's programming -. This gives you a derivation, the self-contained instructions for performing a build. Then everything moves to a sealed build environment, compilation occurs there, and you get a symlink back. Results that aren't linked can be garbage-collected, just like in every decent programming language. Also it's non-strict.

Just for fun, I let many revisions of a derivation compile in parallel (their results can coexist, which is such an essential need), and I noticed something weird and cool: when two processes have a common dependency, the first one to get to building it puts a lock to signal that fact, and the other simply waits on it! That's just such a proof of good design, such a shining example of how using good theory leads to good programs...

No really: TRY NIXOS ANONS.
>>
>>54806144
putting it in green text and mocking it doesn't make it any less true, faggot
>>
>>54806107
>What are you working on, /g/?
Being a noob and working my way through the first chapters of C++ for Everyone (2nd Edition).

This programming stuff is quite engrossing.
I've heard that it's customary to wear pretty socks though (such as how it's custom to start off with "Hello World"), unfortunately I don't have any ;_;
>>
>>54806160
Static typing is not a sufficient condition for good type safety.
>>
>>54806164
It's sufficient enough.
>>
Did I triforce right guys?

import turtle

def L_system(rules, prev_str):
next_str = ""

for i in range(len(prev_str)):

for rule in rules:
if (prev_str[i] == rule[0]):
next_str += rule[1]

return next_str

def L_system_run(n):

turtle.speed(0)

rules = ([
#variables:
['A', "+B-A-B+"],
['B', "-A+B+A-"],

#constants:
['+', "+"],
['-', "-"]
])

s = "A" #axiom
for i in range(n):
s = L_system(rules, s)
print(s)

return s

def L_system_draw(string):

dist = 2
angle = 60

for character in string:
if (character == "A" or character == "B"):
turtle.forward(dist)
elif (character == "+"):
turtle.left(angle)
elif (character == "-"):
turtle.right(angle)

L_system_draw(L_system_run(7))
>>
>>54806107
One guy who works for Nordeus said to me that Java is bad and not worth learning and that C++ is a lot faster and better than Java. He said that Java is basically stupid man's C++.
>>
>>54806120
When I tried it before it lacked decoupling between packages and optional runtime dependencies. You could disable optional dependencies, but this would lead to a different package hash negating the use of prebuilt binaries.

Therefore, the culture seems to have all default package builds with all optional dependencies on. This leads to situations such as installing mutt and getting python too! (mutt -> gpgme -> glib -> python)

Last time I checked, if you installed git, you'd also get subversion, etc. Did they change this ?
>>
>>54806181
>C has good type safety
>Java has good type safety
>>
>>54806143
>mocking people for their sex
Why do you have to be sexist?
There's literally nothing wrong with women in tech.
>>
>>54806220
heteronormative scum
>>
>>54806188
Sounds accurate.
Why would you move to a platform that's less portable (Java) while gaining nothing but a garbage collector?
Because you can't deal with memory. Which isn't hard at all. Which would make you stupid.
>>
Java or C++/C#, which is more used in businesses or larger companies?
>>
>>54806264
Java, but C++ is used for more important things.
>>
>>54806252
>while gaining nothing but a garbage collector?

You could always use Boehm's GC and stay with C. :^)
>>
Working on implementing a trie dictionary for this class I'm in.

Got it to work but I'm having a logical error with node creation or node access. I've pretty much resigned to rewriting it using the old code as a reference to see if i can root out the error.
>>
>>54806107
#include <stdio.h>

int main(){

int e = 5, f;
f = ++e + ++e + ++e + ++e + ++e + ++e + ++e + ++e + ++e + ++e + ++e + ++e;

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

return 0;

}


How much is f?
>>
My only programming experience is with ti84 BASIC. How do I learn C++ or what should I learn?
>>
>>54806305
US dollar or pound sterling?
>>
>>54806305
it's 139 faggot
>>
File: nice.png (4 KB, 354x293) Image search: [Google]
nice.png
4 KB, 354x293
>>54806182
very nice dude
>>
>>54806252
If you think memory is the only thing Java solves in terms of C++ then frankly you're retarded.
>>
>>54806333

Iranian Rial.
>>
>>54806353
$ valgrind /usr/bin/java


JUST
>>
File: ika gets nekkid.gif (1 MB, 416x396) Image search: [Google]
ika gets nekkid.gif
1 MB, 416x396
int i = 1;
++i++;
fprintf(stdout, "%d", *(int *)&i);
// -> ???


99% of programmers will get this wrong!
>>
>>54806353
What else, then? Keep in mind that C++ has gained tons of useful features in the last few updates, whereas Java has gotten barely anything.
>>
>>54806270
Is C# even used at all? They're teaching it us in school.
>>
I enjoy C quite a bit. What do C programmers get hired for now a days?
>>
>>54806410
yeah, by microsoft slaves
>>
>>54806410
Not as much as Java, but if you know one you basically know the other.
>>
>>54806392
 error: lvalue required as increment operand


>>>/a/
>>
>>54805450
>>54805816
>>54805947

CAN WE LITERALLY FUCKING BAN THEM ALL
>>
File: 1448669112662.jpg (3 MB, 2560x2880) Image search: [Google]
1448669112662.jpg
3 MB, 2560x2880
>tfw your android application has 3 installs including yourself
>>
>>54806410
Yes in industry. It will replace Java soon.
>>
>>54806412
C programmers don't get hired.
Nobody writes new projects in C anymore.
>>
>>54806436
What is it?
>>
My purely type-based termination scheme works painlessly for recursion, corecursion, a mix of the two, as well as (co)inductive-(co)recursive definitions. As far as I can tell, it's also sound, as it's fundamentally based on the technique described in "Type-Based Termination, Inflationary Fixed-Points, and Mixed Inductive-Coinductive Types", just with a sexier presentation.
www2.tcs.ifi.lmu.de/~abel/talkFICS2012.pdf

Now, to implement it.
>>
>>54806476
shit
>>
>>54806214
how does java not have good type safety?
>>
>>54806473
Forever a Linux developer?
>>
>>54806188
>Java is basically stupid man's C++.
but that's why you learn java first, and then C++ will be a piece of cake.

>>54806406
feature creep is one of the things that java solves
>>
>>54806149
Yes, git still does unfortunately depend on subversion rn. (Nix over ArchLinux here). Sucks. We'll see how it evolves. In the worst case scenario I'll end up using Nix over some other distro for fresh software maybe...
>>
>>54806495
Because almost fucking everything can be null.

Yeah, there's Optional, but that has runtime overhead and is a pain in the ass to use because >no ADTs.

>>54806511
More features =/= feature creep. Not that C++ doesn't have feature creep, but that's being dealt with through the Core Guidelines. Whereas Java just doesn't have many features at all.
>>
>>54806418
Most of the companies here are hiring for C languages though. Or web development, but fuck that.

>>54806419
So only the syntax is slightly different, or what are the major differences, since I can't imagine it's the same as c++ and c#.

>>54806443
Okay.

Which database programs should I use? They started us with MSaccess, and now we're at MySQL, are these two used or should I drop them in favour of different?
>>
>>54806551
Mostly the syntax that's different, yeah.
>>
What's the best resource to learn C# in my case ?

I have experience in Python but it's only pure scientific knowledge (I've designed mathematical and physical models for college, that's all), and all C# books I've come across seem to be either intended for experienced programmers or total shit.
>>
>>54806551
>MSaccess
Forget about it.

>>54806551
>MySQL
Yes. It's OK.
>>
>>54806107
Is Visual Basic 6.0 worth learning. I never programmed before and I've heard VB 6 is pretty easy and you can program games using DirectX. I'm interested in writing pong, tetris, arkanoid, pac man clones etc just for the lulz.
>>
Which is better

Extensive pseudo code modeling or
write rewrite until it works?
>>
>>54806590
Instead of using an obsolete language just learn Python, it's as simple and yet useful and you can use PyGame, PySDL or Python SFML for such games just fine.
>>
>>54806607
How are you gonna know your pseudocode is correct without turning it into real code and running it? Or, if you're fine with desk checking, why does it have to be in pseudocode?
>>
>>54806607
Trial and error all the way
>>
>>54806682
my high melanin friend
>>
>>54806689
Terrible choice in friends
>>
>>54806208
See >>54806527, sorry
>>
git vs svn

which is the best?
>>
File: kek.gif (1019 KB, 500x373) Image search: [Google]
kek.gif
1019 KB, 500x373
Is 21 too late to get into programming? It seems like everyone started in their mid teens
>>
>>54806758
way too late
>>
>>54806802
;_;
Does a little knowledge of BASIC help?
>>
>>54806758
I'm 28 just started a few months ago. Some concepts don't click as fast but as you get older you become more tenacious.

https://ossu.firebaseapp.com/#/

A good free trail of courses. I'm still in the first class though.
>>
>>54806758
Just do it faggot.
>>
>>54806352
thank you!
Wikipedia has a good starting article on L-systems.
https://en.wikipedia.org/wiki/L-system
>>
>>54806851
if you do
 from turtle import * 


you only need to
    for character in string:
if (character == "A" or character == "B"):
fd(dist)
elif (character == "+"):
lt(angle)
elif (character == "-"):
rt(angle)


without all those verbose stuff (turlte.forward, turtle.right...)
>>
>>54806802
Bullshit
>>
>>54806758
Depends how adept you are. If you can pick it up quickly you can sail past more experienced programmers in no time.
>>
>>54806562
How long would it take to transition from C# to Java?
>>54806582
Any better program for databases than MySQL?
>>
>>54806939
>>54806829
>>54806826
>>54806758
what's a good language to learn for a beginner. I don't have any ambitions of being the next great indy game dev or stuff like that, but I just want to learn how to make my computer do... stuff.
>>
>>54806972
Maybe MariaDB which is the successor of MySQL. You have Oracle too which is free and faster than MySQL, but Oracle doc sucks.
>>
>>54806987
Start with C, a simple text editor and the gcc.
>>
So I'm learning a little about regular expressions...

And I'm having trouble making a regex that matches everything after "foo" (minus the space) for all of the following:
foo baz 42
foo baz42
foo 42

something like this works for the last two, but not the first one
(baz)?[\d]

I would expect something like this to work, but it doesn't work on any of them.
(baz)?^( )?[\d]

any suggestions?
>>
>>54807062
https://regex101.com/
>>
>>54806758
it's not too late at all but ideally you should have at least above-average intelligence
>>
>>54806987
>what's a good language to learn for a beginner

>inb4 C

It's not an easy question to answer, because everyone is different. This is my take on the question

Python: easy on beginners, batteries included
C: will teach you low level hackery, but the community is full of pompous assholes and freetards.
Scheme/Lisp: changes the way you think about programming. Scheme it's basically the most pure language out there, and has a minimalistic syntax which could help a beginner.
>>
>>54807132
x86 assembly
>>
>>54806987
https://docs.oracle.com/javase/tutorial/

seriously... check it out. don't listen to the memers
>>
>>54807062
foo\s+(.*)
>>
>>54807180
ah, yes. That would solve it.
Sorry though, I had meant for 'foo' to be absolutely anything. And that I was specifically trying to match that last portion.
>>
>>54807132
>>54807150

Jesus christ you cunts stop recommending your shitty fucking languages you autists
>>
>>54807204
^\S+\s+(.*)$
>>
>>54807231
shut the fuck up faggot
>>
>>54807231
>Jesus christ you cunts stop recommending your shitty fucking languages you autists

Let's hear your proposal.
>>
>>54807264
C or C++

>>54807251
Are you the Java indian or the Python teenager?
>>
unsigned int i;
unsigned int j;


j & (i != 0U)


vs

j & !!i


vs

j & (bool) i
>>
>>54807280
Retards will oppose this
>>
Starting an internship with a company that builds Ember apps, so I'm practicing with my own little Ember project.
>>
>>54807280
C++ is ok but i recommend the java -> C++ route, see >>54806511
>>
>>54807280
>Are you the Java indian or the Python teenager?

No. i'm the guy making 86K a year writing 3 hours of java code 3 times a week.
>>
>>54807280
C, retarded language with retarded semantics, cripples your mind.

C++, basically a political kitchen sink of a language made to fix C shortcomings while mantaining backwards compatibility.

I'd say Python is best for a beginner. It's easy and has ton of libraries.
>>
>>54807331
There are absolutely no good reasons to start with Java and then go into C++.

>>54807348
If you want someone to do Java for the shitty bigwig software industry, might as well start with a language that won't ruin you for life

>>54807365
Python ruins you for life
>>
>>54807386
>Python ruins you for life
>pseudo-code ruins your life
why
>>
>>54807403
Permanent bad habits

The fact you've recommended Python as a beginner language is evidence of permanent scarring
>>
How do gaymen engines like the CryEngine, and Unreal engine render 3D models at such a large scope with proper optimization? Like for a cityscape?
>>
>>54807386
>Python ruins you for life

Well I started with C and I could say the same thing.
You always try to think in your first language. Sometimes I just couldn't see an obvious solution because it didn't fit in my mental model of computing based on C.
>>
>>54807429
>Permanent bad habits
i write algorithms in python much faster than in C or C++.

i like python to prototype things
>>
>>54807438
C doesn't ruin you for life and you don't always think in terms of your first language

You want a language that covers many of the bases without it being one that recommends it holds your hand, and also one that encourages good style & code

>>54807458
>I write algorithms much faster
Literal evidence of bad habits
>>
>>54807435
instancing
>>
>>54806473
That's really a matter of scale and the environment you're developing for.
>>
>>54807435
Profile profile profile. Don't draw what you don't need, minimise draw calls, minimise state changes, bake lighting, use LOD systems..

Find out what the most expensive part of your pipeline is right now, and focus on optimising that

To minimise draw calls, batch ad much as you can. Minimise state changes too, so load your textures an draw everything you can with those texture. Remove as much overhead from your shaders as possible, have as much data preconputed as you can get away with. For LOD's generate a few different levels of mesh detail, and texture detail, an swap between then at runtime.

What works for you depends on what your timings tell you.
>>
>>54807435
LOD, scene trees, flyweight, etc
>>
>>54807484
>>I write algorithms much faster
>Literal evidence of bad habits
what the fuck are you on?
>>
>>54807429
>Permanent bad habits

MIT teached Scheme as a first programming language, and now they have switched to Python.
Most university went the Pascal -> C -> Java route in the last 20 years. Every solution has its drawbacks.
>>
>>54807526
You don't write them faster in Python, you write them slower in non-Python

>>54807534
This the same MIT that offered a place for clockboy?
>>
Why do we still rely on C?

http://permalink.gmane.org/gmane.comp.security.oss.general/19669
>>
>>54807562
That's not even a C problem.
>>
>>54807562
>Why do we still rely on C?
Because C is still the best at what C does.
>http://permalink.gmane.org/gmane.comp.security.oss.general/19669
>One program does something weird
>It's somehow C's fault
>>
>>54807562
>Why do we still rely on C?

C is like a cult. The language and its zealots need to die.
>>
>>54807508
>>54807489
>>54807514

Yeah, but what about the detail of the models?Are the basic lighting for the models pre-baked onto the texture, while the dynamic lighting occurs minor, or is it something else?
>>
>>54807600
Find me a better language for what it does first then
>>
>>54807600
Confirmed Pybabby memer
>>
>>54807610
Purely talking about the language, Rust.
>>
>>54807587
>Because C is still the best at what C does.

I'm starting to think that C is backed by the NSA for obvious reasons.
>>
>>54807600
We will never die.
C is the past the present and the future.

Ruby will be dead, we will still rule the OS.
Python will be dead, we will still rule the OS
... will be dead, we will still rule the OS.

And maybe soon, we will get rid of evil Fortran. The world is our.
>>
>>54807610
Try B
it's faster, and more reliable.
>>
>>54807643
As in the typeless predecessor language to C?
>>
File: 2.jpg (293 KB, 4096x3034) Image search: [Google]
2.jpg
293 KB, 4096x3034
~~C challenge.~~

write a program that outputs "Hello world!" without using semicolons in your source code

i will post the solution later

GO!
>>
>>54807610
Rust, Ada are relatively mainstream options.
I think will see a systems programming renaissance in the next few years. C is simply inadequate nowadays.
>>
>>54807672
if
>>
>>54807671
precisely

you don't need types to make a program
>>
>>54807672
Easy
#include <stdio.h>

int main(int argc, char *argv[puts("Hello World!")])
{
}
>>
>>54807672
#include <stdio.h>

void main (void) {
if (printf ("Hello world.\r\n")) {} else {}
}


That was so hard.
>>
>>54807689
but you need types to make a well defined program
>>
>>54807672
print("hello world")
>>
>>54807609
shadows and lighting are often baked, like for a skyscraper most of it can't even have a player character casting a shadow on it
>>
>>54807685
>if
not a C program.
>>
File: 1460751987629.jpg (34 KB, 1280x720) Image search: [Google]
1460751987629.jpg
34 KB, 1280x720
>>54807707
>>if
>not a C program.
not a C program
>>
>>54807693
Is it legit?
>>
>>54807693
nice one
>>54807694
nice. you dont need the else clause though
>>54807700
not a C program.
>>54807714
Not an argument.
>>
>>54807620
Where's my Rust compiler for MIPSEL? Is there an equivalent for libcurl written in Rust?

>>54807684
>I think will see a systems programming renaissance in the next few years. C is simply inadequate nowadays.

For what systems programming tasks exactly is C inadequate, and how?
>>
>>54807738
>purely the language
>HERP DERP COMPILER
okay then
>>
>>54807733
post the solution you had in mind
>>
>>54807752
>platform support isn't part of a language's usefulness
>>
>>54807731
Yes
>>
>>54807754
it was already posted
but here you go
#include <stdio.h>

int main()
{
if (printf("Hello world!\n")){}
}
>>
>>54807693
>>54807694
>>54807776

NOT PORTABLE
COMPILER DEPENDENT
VALID ON NO KNOWN COMPILER
>>
>>54807793
Did you even try any of them?
Or are you one of those memers who only uses C89?
>>
>>54807738
>For what systems programming tasks exactly is C inadequate, and how?

Everything high reliability. You know that basically every security in our programs is caused by the flaws of C.

>inb4 idiot programmers

C makes programming too error prone. It's inexcusable in CURRENT_YEAR
>>
>>54807738
Rust uses LLVM as its backend, and works without a runtime.
You can use the Rust bindings to curl, but there are also "native" HTTP libraries like hyper.
>>
What's a personal project that looks good on a resume?
>>
>>54807811
#include <stdio.h>

S E M I C O L O N S
>>
>>54807815
Maybe you should just program better.
>>
>>54807824
fizzbuzz
>>
>>54807824
An OS
Bonus points if it runs on any architecture
>>
>>54807830
Has literally nothing to do with portability.
Also the original question said "in your source code".
Standard headers are not my source code.
>>
>>54807831

Enjoy your core dumps
>>
>>54807793
How 54807694 is compiler dependent? Explain to me.
>>
>>54807904
>>54807830
>>
>>54807933
What?
>>
>>54806107
Doesn't really matter whether you go left-to-right or right-to-left, it's going to be 138 either way.
>>
>>54807952
?
>>
>>54807952
Derp, meant to reply to: >>54806091
>>
>>54807974
it's undefined behavior, gcc gives an "off by one" result like 137 iirc
>>
>>54807982
139, i just tried it

http://ideone.com/70OmNB
>>
>>54806364
Iran isn't real
>>
I find it interesting that /g/ likes to constantly spam Himegoto, because it shows that it cares only about the appearance of the characters in an anime, and not the actual storyline of the anime.

For those of you who haven't seen Himegoto, the anime that this pink haired trap that keeps getting posted in /dpt/ and other parts of /g/ is from, allow me to summarize.

1. The main character, Hime, is not a female, or a transgender character. He is a male and identifies as male.

2. The main character is a reluctant crossdresser. He doesn't do it because he particularly likes to, but because he's basically forced into it. His parents are constantly traveling and racking up debts, and somehow this logically means that thugs will try and molest him to pay for his parents' debts. Because it's completely logical to assume that a child can inherit their parents debts, and a homosexual rapist wouldn't get eaten alive in jail. But fuck it, plot reasons. Some rich girl agrees to pay for everything as long as he crossdresses and gets put into compromising situations that are just as horrible as if they didn't assume his parents' debt. Also, peer pressure. His brother, and two of his brothers friends are all crossdressers. In some ways, they actually fuck with his brain a bit to get him to like it. They pretty much force him to buy a shit ton of bras that he didn't want to wear, and when he decides to actually try one on in private because fuck it, might as well see what the big deal is about? BAM! Positive reinforcement comes in to hammer that nail in.

Hime is literally groomed over the series to crossdress on a regular basis despite otherwise being a normal, albeit shy, male. If you watch the show with a critical eye, you'll almost invariably think, "damn, I feel sorry for this poor fuck."

3. The series is only 13 episodes, each of which is 5-6 minutes long, including the opening theme, which is 30 seconds long. If you have an hour or so to kill, you could watch it all.
>>
>>54808031
didn't read
>>
>>54808031
it's like 2 or 3 actual fags that post it
>>
>>54808031
This is a programming thread. If you can't accept that then leave.
>>
I'm slowly switching over from camelCase to using underscores and I don't know why
>>
>>54808031
/dpt/ has nothing to do with traps you faggot, it's all about crossdressing

Did the newfags convert you or something?
>>
>>54807815
>Everything high reliability.
A poorly written program in any language will be unreliable.

>You know that basically every security in our programs is caused by the flaws of C.
>every
I'm doubtful that even a majority of security issues can be directly related to an error in a C program, and especially not to something that is exclusively possible through C.

>flaws of C.
>inb4 idiot programmers
Mentioning a a valid point before me doesn't invalidate it. Flawed programs are the fault of the programmer(s) and project architects. I understand what you mean, that in general poorly designed *ANYTHING* can lead to otherwise avoidable issues. This is considered an issue / flaw with the *THING* itself, even though it's perfectly capable of being used properly and without issue (think doors with the hinges hidden and the same handle on both sides; Norman doors). This in mind, I don't believe this is the case with the C language.

>C makes programming too error prone.
Maybe for people who are new to using C. Anyone who's reasonably experienced won't make those mistakes. I'm sure that many of the examples you've already thought up to attribute to issues with 'C' are actually shitty project design/architecture issues.

>>54808031
Why did you bother posting this? You know you're not supposed to actually send the letters you write to people to de-stress right?
>>
>>54808031
Go drink bleach you anime watching lard ass.
>>
File: s.png (151 KB, 421x500) Image search: [Google]
s.png
151 KB, 421x500
>>54807991
>12 increment operators
>gcc finds 13
>>
>>54808112
might be intentional because of the UB, gives you a better chance of spotting the mistake, otherwise i have no idea why it would give the "wrong" result
>>
File: MyOS3.png (1 KB, 720x400) Image search: [Google]
MyOS3.png
1 KB, 720x400
Continuing work on my OS
Fun fact: It is one of the most secure OS's out there right now
>>
>>54807684

I would love to see a systems programming renaissance. Maybe I'll make a systems language focused on consistent and highly flexible metaprogramming/compile-time options.

>>54807793

The last two at least I know are valid, portable, and well-defined.

if (expr) { }


is well-defined. The expression must be evaluated. Since printf is a function that doesn't always return the same value (it can fail), it's not a constant expression, and you can't optimize it away.
>>
>>54808031
>Because it's completely logical to assume that a child can inherit their parents debts
It is in some countries, I inherited $30k debt after my parents died.
>>
>>54808190
>>54807933
>>
>>54808083
>>>54807815 (You)
>>Everything high reliability.
>A poorly written program in any language will be unreliable.

C just encourages poorly written software. Ada catches a lot of typical C programmers' errors at compile time.


>I'm doubtful that even a majority of security issues can be directly related to an error in a C program, and especially not to something that is exclusively possible through C.

Buffer overflows are a defining characteristic of C. And bounds checking has been used at least since the early 60's. No excuse for not having it now.

You are just ignorant and/or disingenuous, like a lot of C programmers.
>>
>>54808182
>Fun fact: It is one of the most secure OS's out there right now
because it does nothing?
>>
>>54808244
Exactly
>>
>>54808182
As in OpenBSD secure or TempleOS secure
>>
>>54808273
Windows 10 release day secure
>>
>>54808273
As in "it is incapable of handling any kind of input right now" secure
>>
>>54808287
You realise OS security includes meddling with the hardware, right?
>>
>>54808303
Don't worry, his mom keeps the basement locked up tight
>>
>>54808303
No, and where would I read up on that
>>54808333
I'll have you know my mom loves me and makes me great food everyday
>>
>>54808060
Tell that to the people who feel the need to post traps every thread. For example, this guy: >>54808076

>>54808083
It's not to de-stress, it's to ask a question to the anon that keeps posting Himegoto every other OP, about why the hell they would do so, and what the hell they took out of the show.

>>54808097
No, I think I won't.

>>54808112
A running joke in my compilers class: "can't we just tell the programmer not to do (stupid shit like) that?" The answer is always no. I think this was because of a time when our professor recalled a story of when someone pointed out that a calculator he wrote crashed when fed a .jpg as input.

>>54808207
Do you live in the third world?
>>
>>54806987
>>54807037
>>54807132
>>54807150
>>54807231
>>54807251
>>54807264
>>54807280
>>54807305
>>54807365
>>54807386
>>54807438
>>54807542
I don't know why I bothered asking /g/ for any advice
>>
Where is a good place to start learning Fortran?
>>
>>54808369
It's literally just C programmers being the autists they always are. Look across the web, you won't find users of other languages behaving the way they do. The language attracts people with a severe social skill deficit.
>>
>>54808380
https://www.discogs.com/Fortran-Place-To-Be-Sardines/release/1750
>>
>>54808356
>Do you live in the third world?

Depends how you define third world.
For example what about countries that as a citizen require you to pay income tax even if you haven't lived there in over 20 years, and are already paying your taxes to your adoptive nation?

Surely no freedom-loving country would force such a thing...
>>
>>54808410
>It's literally just C programmers being the autists they always are.

The cmen never stop.
>>
>>54808369
>I don't know why I bothered asking /g/ for any advice

NEVER ask /g/ for advice.
Also stay away from C autists.
>>
>>54808420
:^)

>>54808423
Protip: You can retain American citizenship and avoid paying that tax while working overseas, you just need to be working for the right company.
>>
>>54808410
>>54808443
>>54808452
Stay mad faggots, #C4Life
>>
>>54808242
>C just encourages poorly written software.
For people who exclusively use higher level languages, you're absolutely correct. There are tonnes of best practices rule sets you can follow to avoid this however.

>Ada catches a lot of typical C programmers' errors at compile time.
I actually don't mind Ada, but it's benefits really aren't useful in a lot of cases, not to mention it's also less flexible.

>bounds checking has been used at least since the early 60's. No excuse for not having it now.
Performance. If you want it or need it you can implement it yourself. The language doesn't and shouldn't try to do everything imaginable for you.

>You are just ignorant and/or disingenuous, like a lot of C programmers.
Was that really necessary? Name-calling in $(date +%Y). Anyway, I understand that C isn't the best choice for every application, but that doesn't mean it's no the best for any, nor is it somehow "flawed" or inappropriate to use anywhere. A good number of the most used and most useful pieces of software in the world are written in C.

>>54808410
>you won't find users of other languages behaving the way they do
You'll often find them behaving worse; see: 'pythonic', 'node.js + I feel unsafe', any serious discussion of Perl, Haskell or Lisp, Rust.

>the rest
Whatever you say.
>>
writing a binary tree to disk
>>
Reminder that dependent types allow you to enforce bounds checking without "defensive" overhead.
>>
>>54808491
you better be using c to do so or i'm going to piss my pants and cry and call you every name under the sun :^)
>>
>>54808461
>C
>No templates
>Standard library too small
>No classes
OS dev sure, but why on earth would anyone use it over C++ for any serious application development?
>>
>>54808509
cpp. first few assignments in the class were done in c
>>
>>54808423

To be fair, you can always revoke your citizenship and not have to pay such taxes (in which case, it's less a tax and more a "keep your citizenship fee"). The US does have it's problems, but at the very least, we don't allow people to be bound to contracts that they aren't a fucking party to. Allowing a person's child to take on someone's debt is like saying your neighbor or your brother can take on your debt.
>>
>>54806305
138
>>
I'm working on a game using the Visual Basic .NET language.
>>
>>54808486
>For people who exclusively use higher level languages, you're absolutely correct. There are tonnes of best practices rule sets you can follow to avoid this however.

You only need those rules because the language is flawed.

>>Ada catches a lot of typical C programmers' errors at compile time.
>I actually don't mind Ada, but it's benefits really aren't useful in a lot of cases, not to mention it's also less flexible.

Tell that to Boeing.

>>bounds checking has been used at least since the early 60's. No excuse for not having it now.
>Performance. If you want it or need it you can implement it yourself. The language doesn't and shouldn't try to do everything imaginable for you.

If you really need the performance you could disable bounds checking. But it shouldn't be the default. That's a source of countless bugs and security exploits.

>>You are just ignorant and/or disingenuous, like a lot of C programmers.
>Was that really necessary? Name-calling in $(date +%Y). Anyway, I understand that C isn't the best choice for every application, but that doesn't mean it's no the best for any, nor is it somehow "flawed" or inappropriate to use anywhere. A good number of the most used and most useful pieces of software in the world are written in C.

I rest my case.
>>
>>54808585
>You only need those rules because the language is flawed.

>the language should stop me from making any mistakes

>Tell that to Boeing.

Aerospace, a good use case for Ada and leaded solder.

>I rest my case.
What was your conclusion?

Also, a sidebar: why is it that people claim that C programmers are autistic/INSULT OF THE DAY, but it's they themselves who take personal offence to anyone using or recommending C and proceed to sperg out and derail threads?
>>
File: 2857121994_83a0ff6b25_b.jpg (692 KB, 1024x736) Image search: [Google]
2857121994_83a0ff6b25_b.jpg
692 KB, 1024x736
For fuck's sake, why is every single resource for learning C++, or C for that matter, so universally wanting? From the very start I wanted to know how to access files, parse through them, and arbitrarily load pieces into memory. I also wanted to know how to access arguments passed on the commandline. That's it.

I recognize why all the foundational work is required to see the overall framework you're using for any given task, and how elements fit together. But come on. There's one tiny page explicitly dealing with parsing cl arguments. Two, put bluntly, absolutely minimal pages addressing STL functions for dealing with files.

Conditional execution and handling of external data are fundamental aspects of computing. Yes, not modern software design, not 60's software design, computing in the abstract. And near every single person trying to learn likely has these tasks in mind, and wonders how it's done, or wants to get a better idea of the specifics behind their idea for whatever project. And you get there, and there's no goddamn payoff. Or it's all scattered all to fuck where you can't reasonably proceed in serial order and have to jump around and probably end up reading shit on stack exchange or some bullshit. Knowing how to open a file handle and move its pointer around, is not enough.

If I ever become fairly experienced in whatever language, I swear I'm going to write something that introduces file and argument handling the moment arrays, the stack, and the heap are introduced, and builds on it from then on. This is absurd, I have to calm down I'm so near to enraged. Why can't everything be the way I think it should all the time.
>>
>>54808486
>Anyway, I understand that C isn't the best choice for every application, but that doesn't mean it's no the best for any, nor is it somehow "flawed" or inappropriate to use anywhere.

It has its uses in system programming.
>>
File: asdf.png (193 KB, 1918x862) Image search: [Google]
asdf.png
193 KB, 1918x862
who here /fucking retarded/ ?

It took me 1.5 hrs to do pic related.
>>
>>54808688

Because people are trying to shoehorn C in everywhere. Somebody could ask a god-damned web-dev question and the inevitable response to use C.
>>
>>54808688
>What was your conclusion?

C is a deeply flawed language. Use it at your peril, and stop with the meme "C is powerful". C is powerful in the sense that asm is powerful.

>Also, a sidebar: why is it that people claim that C programmers are autistic/INSULT OF THE DAY, but it's they themselves who take personal offence to anyone using or recommending C and proceed to sperg out and derail threads?

It's called payback. Look at your ilk and you will understand.
>>
>>54808804
countHi2 [] = 0
countHi2 ('h' : 'i' : str) = 1 + countHi2 str
countHi2 (_ : str) = countHi2 str
>>
>>54808688
Look at the language those that recommended C used in these replies compared to the ones taking a more level-headed approach - >>54808369
Yes there were a couple exceptions on both sides but that is generally how it usually goes in these threads.
C programmers - at least the majority of the ones that inhabit /dpt/ - are extremely unlikeable people.
>>
>>54808846
So I should just learn python?
>>
>>54808688
And another thing.
When you are a beginner you don't know there is such a thing as application and systems programming.
The C people have tried to shoehorn C where it didn't really belong, and a lot of people were burned as a result.
>>
>>54808717

>There's one tiny page explicitly dealing with parsing cl arguments.

There's not much to explain. The main function takes two arguments, and int called argc, and a char** called argv. The value argc contains the number of arguments, including the program name. The value argv is an array of strings, the first of which is the program name, and each successive one being the arguments supplied via the command line.

That is, in one paragraph, everything a programmer needs to know about parsing command line arguments.
>>
>>54808846
>C programmers - at least the majority of the ones that inhabit /dpt/ - are extremely unlikeable people.

I think they feel personally attacked because better languages now exist. This isn't what Ritchie wanted at all.
>>
>>54808865

This response was best, in my opinion:
>>54807132

>>54808883
Stop trying to derail
>>
What's a good place/book to start learning C# for a total beginner?
>>
>>54808873
There's also getopt(), which I would say is p. useful
>>
C is great for learning and is not wasted time regardless of what your goal is.
>>
>>54808909
But not C++.
>>
>>54808717
man 3 fopen; man 3 fclose
man 3 malloc; man 3 free
man 3 fread; man 3 getdelim; man 3 getline
... main(int argc, char *argv[])

> Why can't everything be the way I think it should all the time.
Because you didn't make it.

>>54808812
You could (but shouldn't) use it for CGI.

>>54808821
>C is powerful in the sense that asm is powerful.
I rest my case. The power of system assembly in a high level language.

>It's called payback. Look at your ilk and you will understand.
Please don't take their bait. C is still a handy and interesting language. Despite what you may believe about it, there's still value in learning it (even if you won't use it), especially as a first language.

>>54808846
See above.

>>54808883
>I think they feel personally attacked because better languages now exist.
I can't speak for everyone, but I at least don't feel that way at all. I recommend learning C as a first language because I believe there's value in understanding how it works, even if in future they'll use something else.

>>54808871
It can be used effectively in both places, but the former would be difficult for someone inexperienced.

>>54808920
This.
>>
>>54808825
incorrect (counts xhi, for example)

it's actually a bit tricker than expected
>>
>>54808924
It's neither standard C but can be used in both C and C++.
>>
>>54808902
>Stop trying to derail

Not an argument.

>>54808928
>You could (but shouldn't) use it for CGI.

That's what I was getting at. People have suggested just that. Hell, I suggested that the other day, but only because someone asked if he could do web programming with C.

>I recommend learning C as a first language because I believe there's value in understanding how it works, even if in future they'll use something else.

I really want to believe you.
>>
>>54808932
Oh, I didn't even see that requirement. In that case:
countHi2 [] = 0
countHi2 ('x' : 'h' : 'i' : str) = countHi2 str
countHi2 ('h' : 'i' : str) = 1 + countHi2 str
countHi2 (_ : str) = countHi2 str


>>54808948
But you shouldn't expect it to be brought up in something for learning C++.
>>
>>54808928
>It can be used effectively in both places, but the former would be difficult for someone inexperienced.

You can program application in asm if you want, doesn't mean you should.
>>
how to generate c source code from machine code?
>>
I hesitated posting those questions in the Stupid question thread, please don't hurt me :

- can you code popular languages (I'm thinking Java to start learning) on an Android smartphone

- what's the minimum laptop (any ref?) to code?

- what are the most useful/requested languages besides Java?

- what are the most requested kind of jobs?

- is it true that you can learn a language in a few months? (with like, 5-8 hours of study/test a day)
>>
>>54808985
>You can program application in asm if you want, doesn't mean you should.

Unless you're Chris Sawyer.
>>
>>54808928
I'd like to believe it's mostly bait but honestly, the Dunning–Kruger effect runs rampant in these threads.
I do agree that it has it's uses and it's definitely an interesting language to use
>>
>>54809006
>inb4 autists bite each others heads off confusing the newb even further
>>
>>54809012

Chris Sawyer is a savant, though. He is on another plane of understanding.
>>
>>54808928
>Despite what you may believe about it, there's still value in learning it (even if you won't use it), especially as a first language.

Things you will believe if you learn C as a first language:
- types are a fuzzy concepts
- arrays are just pointers
- booleans are just integers
- pointers are the main method of abstraction
- speed over correctness is acceptalbe behaviour

I think a better approach is to start with a high level language and then learn systems programming concepts.
>>
>>54809012
I had a bitch of a time doing Fizzbuzz in asm, I have no idea how he did an entire game with it
>>
>>54809006

You should only use C. If you don't use C, you are probably a garbage programmer. Git gud and be a 10X rockstar guru.
>>
>>54808995
please answer me
>>
>>54809057
>types are a fuzzy concepts
This. C programmers have no respect for type systems, as their language brings them up to think "YOU ARE SMARTER THAN THE COMPILER".

Which is true, of course, but that doesn't mean you can't let the compiler handle a lot of the busywork and help you with proving the correctness of your program. Coq, Agda, Isabelle, etc. are called "proof assistants" for a reason.
>>
>>54807672
:^)
#include <stdio.h>

void main(int argc, char** argv)
{
__asm
{
push '!'
push 'd'
push 'l'
push 'r'
push 'o'
push 'W'
push ' '
push 'o'
push 'l'
push 'l'
push 'e'
push 'H'

call putchar
pop eax
call putchar
pop eax
call putchar
pop eax
call putchar
pop eax
call putchar
pop eax
call putchar
pop eax
call putchar
pop eax
call putchar
pop eax
call putchar
pop eax
call putchar
pop eax
call putchar
pop eax
call putchar
pop eax

add esp, 48
}
}


Tested and works in Visual Studio.
Could have made it a bit less verbose by making a loop, but copypasting is easier.
>>
File: smug anime girl maki.jpg (61 KB, 500x375) Image search: [Google]
smug anime girl maki.jpg
61 KB, 500x375
>tfw csci junior in college right now
>tfw trump will gas all the H1B's before i graduate and i'll find a job straight out of school
>>
>>54809077
C++ has 2 pluses, isn't it better?
>>
>>54809043
Everyone should try assembly at least once. I'm learning a bit of it and it looks very interesting and challenging. I think I might like making programs with it.
>>
>>54806107
Fuck off this programming fag meme.
>>
>>54809123
That's a girl, not a trap.
>>
>>54809099
>C programmers have no respect for type systems, as their language brings them up to think "YOU ARE SMARTER THAN THE COMPILER".
You couldn't even back this up
>>
>>54809123
the artist drew a girl and called it a boy. if you want to complain about anything complain about that
>>
>>54808369
it doesn't matter too much which language you pick as long as you pick one of the top 4 languages here:
http://www.tiobe.com/tiobe_index

and stay the fuck away from the next 15 languages below the top 4
>>
>>54809006
native android apps use java
you could do it on a potato to start out
idk, cba to look roflmao xDDD
see above
depends, you wont master the language but you'll understand it well enough. after the first one learning new languages is easy
>>
>>54809116

I've done a bit of it (though not x86) and it's kinda of fun. It gets really interesting when things start to jest werk.
>>
>>54808995
light 6 candles in a ring & sprinkle the blood of a goat in the center
>>
>>54809149
The climb baby
>>
>>54809114
trump is in favor of H1B's though
>>
>>54809115
C++ is pure garbage.
>>
>>54809171

The little AnDrei that could.
>>
>>54809203
C++ has no garbage collection
>>
>>54809213
Apparently it was #12 in '09, so I wonder what caused that
http://www.tiobe.com/tiobe_index?page=D
>>
>>54809149
So I should learn java instead of python? Good lord guys
>>
File: trump h1b.png (83 KB, 591x473) Image search: [Google]
trump h1b.png
83 KB, 591x473
>>54809176
https://www.donaldjtrump.com/positions/immigration-reform

i don't know if people are trolling at this point or if they legitimately believe the things they say. which is it in your case?
>>
>>54809236
"java is bad" is just a meme, and even if you unironically think java is bad, python is seriously ridiculously shit, many times worse than java
>>
File: 1461444393999.gif (2 MB, 320x180) Image search: [Google]
1461444393999.gif
2 MB, 320x180
>>54809250
>"java is bad" is just a meme
Thread replies: 255
Thread images: 19

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

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.