[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: 315
Thread images: 36

File: 1503886901593.gif (2MB, 450x258px) Image search: [Google]
1503886901593.gif
2MB, 450x258px
What are you working on, /g/?

Old thread: >>62129509
>>
File: 1501407299676.jpg (41KB, 600x800px) Image search: [Google]
1501407299676.jpg
41KB, 600x800px
lisp
>>
File: include.jpg (102KB, 1920x1080px) Image search: [Google]
include.jpg
102KB, 1920x1080px
 
#include <assassin.h>
>>
>>62135186
>Pinky never hits ctrl

Shit waifu, honestly.
>>
Why does /dpt/ shit on Scala?
>>
File: 1489491095718.png (740KB, 1834x1200px) Image search: [Google]
1489491095718.png
740KB, 1834x1200px
>>
File: s.png (191KB, 1680x1050px) Image search: [Google]
s.png
191KB, 1680x1050px
>>62135186
>What are you working on, /g/?

Official /dpt/ ultimate SoKoBan
>>
>>62135279
>Official /dpt/
it will never get pass the commitee, just give up.
>>
int add(int a = 5, int b = 3)
{
return a + b;
}

int main()
{
int (*fptr)(void) = add;
}

>error: invalid conversion from 'int (*)(int, int)' to 'int (*)()
default parameters a shit
>>
What would /dpt/ recommend for an IDE for C/C++ , might also dabble in JS, so if I can use one IDE for all of it, that might be best?

Preferably something windows/linux cross platform.
>>
File: 1417927240919.jpg (200KB, 600x443px) Image search: [Google]
1417927240919.jpg
200KB, 600x443px
>>62135291
dpt has a committee?

>>62135322
clion
visual studio code
>>
File: 1483889196850.png (373KB, 867x647px) Image search: [Google]
1483889196850.png
373KB, 867x647px
Writing an imageboard engine in Haskell.
>>
>>62135049
> Seriously, what is your opinion on Rust compared to related languages?
Rust is better than C because it has a clean design which integrates a lot of achievements from the past 20 years of PLT development without compromising on the performance, it's safer and it's more expressive. Rust is better than C++ because it's simpler, more coherent, safer, and doesn't have 40 years of legacy baggage to support. Borrow checker is the main point here, but the type system/pattern matching, generics, error handling, and cargo are important too.

I don't consider Go, D or Swift relevant here since they are all tainted with GC, but even if I didn't care about performance and memory usage, I would definitely use Rust over Go(because Go is a braindead language) and probably over D and Swift as well, because of the type system, error handling, cargo, and the community.
>>
>>62135291
It's in Lisp, everything in Lisp becomes official without comitee.
>>
>>62135365
>because Go is a braindead language
Can someone give me a quick rundown on this meme?
>>
>>62135349
So Clion > Netbeans? Its another one I've heard of as viable for C/C++ but not sure about JS.

VS code isnt really an IDE though right, no GUI debugger? At that point might I just stick with VIM? Or am I wrong to think of VS code this way
>>
>>62135401
>static typing without generics
>returning val, err
>>
>>62135386
Lisp, Scheme or Racket? Does Racket even support CLisp?
>>
>>62135365
>and the community
Oversensitive trannies doesn't seem like a real plus for a language
>>
>>62135322

QtCreator for C/C++
VSCode for JS
>>
>>62135404
>So Clion > Netbeans? Its another one I've heard of as viable for C/C++ but not sure about JS.
netbeans is still maintened? looks like abandon ware now.

>>62135404
>VS code isnt really an IDE though right, no GUI debugger?
https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools
https://code.visualstudio.com/docs/languages/cpp
>>
>>62135414
All Lisps are OK.
>>
File: QTWthpq.jpg (114KB, 1190x1698px) Image search: [Google]
QTWthpq.jpg
114KB, 1190x1698px
>>62135401
The language was specifically designed to be as simple as possible because Java is too hard to the herds of Pajeets Google employ.
>>
>>62135315
>int (*fptr)(void)
Remove the void.
>>
>>62135506
won't change anything, it's sepples.
>>
>>62135356
Neato, got GitHub or something? I could contribute every now and again.
>>
>>62135477
The saddest thing that will happen when Go finally implements generics is the death of all these memes
>>
>>62135186
Making a random image viewer (windows forms C#). I was tired of Windows Photo Viewer's slideshow functionality. It's slow and forces the slideshow onto the main monitor in a dual monitor setup. Plus it can only handle once instance as far as I know. Now I can finally spam slideshows left and right woohoo.
>>
>>62135649
Generics is one of many issues Go has.
>error handling
>no tuples
>bad dependency management
>>
>>62135649
I'm sure they'll find the most retarded way to do it, making them a sugar for interface{} for example, like Java does. The funniest thing will be to watch Go-fags, who spent years claiming that no one needs generics, suddenly change gears and start praising Pike for implementing them.
>>
>>62135613
Soon. I will make it public after implementing all the essential endpoints.
>>
>>62135856
b-but that's the fun part..
>>
File: 1483889196786.png (422KB, 789x720px) Image search: [Google]
1483889196786.png
422KB, 789x720px
>>62135913
Sorry, anon.
There will still be a lot of fun things to do afterwards.
>>
File: 06b.jpg (192KB, 800x600px) Image search: [Google]
06b.jpg
192KB, 800x600px
>>62136076
Alright, hope I don't miss you announcing it or something…
>>
>>62135365
What would you recommend for someone wanting to learn Rust but knowing nothing about it? I come from a C# background.
>>
>>62136385
Whatever they recommend on the site now, I guess it's the second edition of the book. I've read the book, rust-by-example and a lot of blog posts explaining stuff, but the real appreciation of the language came after I spent some time reading the source of the standard library. It's clear, well-designed and well-documented code which is easy to read and, unsurprisingly, makes perfect use of the language.
>>
>>62135315
Default params just make an implicit overload. Wouldn't doing an explicit overload help?
>>
>>62136573
To be honest, I always thought it worked like overloads do. You could certainly do that though.
>>
>>62136269
I am writing a image board in node express react and mongodb
>>
File: 1460515560181.jpg (475KB, 852x973px) Image search: [Google]
1460515560181.jpg
475KB, 852x973px
Be honest, have you done ALL the exercises from K&R?
>>
>>62136737
no thanks
>>
File: 15006286503.jpg (163KB, 1024x768px) Image search: [Google]
15006286503.jpg
163KB, 1024x768px
PROGRAMMING CHALLENGE

Make a £sd calculator. It must be able to add, subtract in £sd, multiply and divide by decimal fractions. Lowest coin is farthing.

So far, we have a solution in APL and J!
What other languages will present /g/ later?
>>
File: wonder_of_git.png (166KB, 957x1038px) Image search: [Google]
wonder_of_git.png
166KB, 957x1038px
What is the best way to do it? I'm thinking of resetting the branch, redoing my commits in a logical way, then creating separate branches on top of master and cherry-picking these new commits into them.
Needless to say, straightforward rebase results in a shitton of conflicts and I don't really need ~1/3 of this code.
>>
>>62136744
I wonder if anyone unsarcastically solved every ex from sicp
>>
File: 1501562130575.png (506KB, 683x720px) Image search: [Google]
1501562130575.png
506KB, 683x720px
>>62136762
>>
What's the problem here?
        do {
scanf("%d", &int_1);
scanf("%d", &int_2);
if (int_1 % int_2 != 0)
printf("%d does not evenly divide %d.\n", int_2, int_1);
else if ( int_1 % int_2 == 0)
printf("%d evenly divides %d.\n", int_2, int_1);


} while (int_1 != 0 || int_2 != 0);


Everything works besides
while (int_1 != 0 || int_2 != 0);
intention if that was to exit loop when 0 is entered but when I enter 0 it asks for another scanf and if I input 0 program crashes
>>
>>62137110
You probably didn't initialize variables.
>>
>>62137110
>0
>evenly divides
>evenly divides by zero
Think about it anon.
>>
>>62137110
>>62137153
Oh wait, you just divide by zero here.
>>
>>62136762
This sounds so easy and annoying at the same time I'm not even getting around to checking the conversion rates.
>>
>>62137153
>>62137169
>>62137188
Thanks
        zero = 1;
do {
scanf("%d", &int_1);
scanf("%d", &int_2);
if (int_1 == 0 || int_2 == 0)
zero = 0;
else if (int_1 % int_2 != 0)
printf("%d does not evenly divide %d.\n", int_2, int_1);
else if ( int_1 % int_2 == 0)
printf("%d evenly divides %d.\n", int_2, int_1);


} while (zero == 1);


>>62137198
that didn't work either
>>
>>62137220
4 farthings = 1 penny
12 pence = 1 shilling
20 shillings = 1 pound
>>
>>62137010
What I do is

1. Squash any work on my branch that I don't need: make the work as self-contained as reasonably possible without losing things we want to preserve. If you made a commit then in next commit reverted half of it, just squash it in: it's not important, it will be gone anyway and you have half a commit less to cause conflicts for the rest of the branch
2. If number of my commits is now small, rebase and resolve. If not either cherry-pick one at a time (really this is just a rebase but easier to see what's happening) and fix them up or cherry-pick hunks that are still needed, carefully examining what the conflicts are on the way. Usually want to build after each commit conflict resolution to assure sane bisect: the fewer commits you have, the better off you are.

Hm, I guess basically just squash all you can and have fun resolving whatever conflicts you have left for next few hours…
>>
>>62137110
try something like
    scanf("%d", &int_1);
scanf("%d", &int_2);

while (int_1 != 0 && int_2 != 0) {
if (int_1 % int_2 != 0)
printf("%d does not evenly divide %d.\n", int_2, int_1);
else if ( int_1 % int_2 == 0)
printf("%d evenly divides %d.\n", int_2, int_1);
scanf("%d", &int_1);
scanf("%d", &int_2);
}
>>
>>62135236

Nobody loves scala.
Functional guys hate that you can cheat your way through and use plain Java whenever you want.
Java guys hate the complicated syntax and freak the hell out from the Shenanigans you can do with this language. You can write 30 lines Java in 10 lines of Scala, but fully understanding this 10 lines is damn hard.


>>62136744

Err... of course!!
Just like I did e-every lesson in SICP.
Who wouldn't, hehe?
Stupid question.
>>
>>62137251
That does make more sense. It was a problem from do-while chapter so do-while got stuck in my mind when I was writing that.
What is the point to do-while anyway if you can write it like that?
>>
>>62137248
> Hm, I guess basically just squash all you can and have fun resolving whatever conflicts you have left for next few hours…
Yeah, I guess this is that I'm going to do now.
>>
>>62137328
Your logic was right, the do-while is used when you want to run that piece of code at least one time.

The problem was when you tried to divide by zero.
>>
>>62137328
>What is the point to do-while
It's the cleanest way to guarantee at least 1 execution of the loop.
>>
want to get decent at programming just finished college (uk) so i'm 18. I have experience in visual basic (yes that what my qualification based on) and html, php js. Is it better to learn something such as c over web languages. Which language should i start to learn and which books should i torrent
>>
>>62137456
Read most stuff Knuth wrote, especially AoCP. Choose any reasonably modern language you want. /g/ hates Java but it's the most likely to land you a job.
>>
>>62137503
I am doing a foundation year at university to get my grades up so want to get good at a language until i start my comp sci degree i don't really know what they will be teaching i sort of want to know how to make websites well is php good to learn or would ruby be better
>>
>>62137531
I also want to try playing around with neural nets at some point do you know which language would be good for that
>>
>>62137531
If you're going to uni for CS then anything webdev will be completely useless (as in you'll do it in your 3rd year or later). Git gud at math, read up on algorithms and learn C/C++ as many professors like it.
>>
redpill me on unity builds senpaitachi.
are they good for code size? are they good for optimisation? do they really cripple compile times? Assume I've only got a project of a few thousand lines
>>
>>62137578
Depends, but you probably want to do something experimental and don't care about ultra optimization. Python is good for prototyping (and has cool libs for neural nets), switch to C++ or Java (if you're a scrub) to get better performance if needed.
>>
>>62137600
it's pretty project dependent, and if you only have a few kloc i would just try it and compare. it's pretty easy to set up, just include cpp at the bottom of your headers
>>
>learn basic lisp features
>can't do anything because there were no talk about I/O funtions
what do?
>>
>>62137814
No one "does" anything with lisp, silly, you learn to feel smug on the internet.
>>
>>62137814
Google "lisp io"?
>>
>>62137814
What kind of shitty dialect doesn't have I/O? In CL you have open, close, with-open-file, etc, and the #p reader macro for pathnames.
>>62137863
Only horrible languages will get you a job, so you may as well learn a good one for its own sake.
>>
daily reminder that as long as people use linux, there will be need for C
>>
>>62137913
>What kind of shitty dialect doesn't have I/O?
One that was in SICP.
>>
>>62137986
Scheme is probably implementation dependent, since it's a very small language at the core.
>>
What's an interesting operating system that I can write about that was introduced before 1990, and that wasn't Windows, UNIX, or Mac?
>>
>>62138066
BSD
>>
>>62138077
>BSD
>Not unix
>>
>>62138066
vms/openvms
>>
>>62135725
>error handling
No different than doing it in languages without try/catch blocks

>No tuples
Don't need them when you have multiple return values from functions, and if you ABSOLUTELY need them it should belong to a struct, and if that seems overkill you need to re-evaluate your program structure

>Bad dependency management
Yeah that part is dogshit
>>
>>62138066
Inferno
>>
>>62138091
>vms
>not windows
>>
>>62138066
AmigaOS
>>
>>62138105
vms is hardly windows.
you're thinking of os/2. sure same designer but nothing about them is the same.
>>
>>62135356
you meant to say pretending
>>
File: 1gw8yqg2.png (76KB, 987x871px) Image search: [Google]
1gw8yqg2.png
76KB, 987x871px
your most qualified prospect is morbidly obese
do you still hire
>>
I'm studying WinServer 2012 and i have a question

I have a working server with a DC/AD/DNS/DHCP on it. I want to add another server that has IIS in the server group

It founds the IIS server, i can ping it (it has static IP of 192.168.152.20 while my main server has 192.168.152.10). DHCP scope starts at .100-120

Problem is, i can't ping google.com or any name on that 2nd server, so it means DNS isn't working correctly. I tried DNS on the first one, it works, i added another A record into the DNS database with static IP, flushed the DNS with ipconfig /flushdns, but shit still doesn't work. Any other ping works on both servers.

Any idea?
>>
what language should i learn next poll (bash vs perl6 vs crystal)
http://www.strawpoll.me/13810583
>>
>>62138168
Bash, its the only useful one. Perl6 is DoA and Crystal doesnt even have windows compatibility
>>
>>62138149
No hire. Tell him to come back when he works out his issues
I got nothing against fat people but you don't eat that fucking much unless there's some dark ass shit in your psyche
>>
>>62138158
by the way, i tried installing from main server some additional role onto the 2nd server and it works, so only dns isn't working
>>
when will reactos be good so that all the winfags can comfortably become upstanding members of foss society
>>
>>62138149
I first consult with the services guys to see if it would be hard to get a chair and a table for him, and a work place where no one would have to smell him sweating all the day long. If it's hard, then I just skip him.
>>
>>62138278
in another 19 years
>>
>>62138188
A DM I knew had a rule that he'd let you into his session only if you could do 30 pushups. Weeded out the worst spergs really quickly and efficiently. Session quality improved tenfold.
>>
>>62138179
who cares about windows cuck
>>
How to prevent C compiler from compiling code without explicit type conversions?
>>
>>62138320
you'll take your promotions and you'll like it.
>>
>>62138320
why?
>>
>>62138149
dumb frogposter
>your most qualified prospect is morbidly obese
stop talking about situations that are impossible
>>
>>62138303
The entire software industry
>>
>>62138320
>How to prevent C compiler from compiling code without explicit type conversions?
If only.
>>
I'm currently working on a window manager from scratch, if anything just as a personal project to help get me a job down the line. I've just started and I'm about 5 hours in combined between reading Xlib documentation and writing/ esperimenting with the program. I'm writing it in C. I'm now wondering, the more I read, ifI should just bail on Xlib and start learning XCB before I get too deep into Xlib. Any advice from the C gurus here?
>>
>>62138320
Don't use explicit conversions? They're explicit after all.
>>
>>62138363
WAYLAND YOU FOOL
>>
>>62138300
but what about the strongfats
>>
>>62138368
I said I don't want code to be compiled if implicit conversions are present there.
>>
>>62138320
That defeats the purpose of using C.
C's static type system is deliberately weak to allow for low level shenanigans. Without the ability to concisely write unsafe high performance code, C would pretty much be a piece of shit.
Why would you remove the feature that makes the language tolerable to work with.
>>
>>62138400
-Wconversion -Wtraditional-conversion -Werror (gcc/clang) will get you some of the way there.
but if you're worried about type safety. C is one of the absolute worst languages to be using.
>>
>>62135315
wtf is this makes no sense
>>
>>62138398
If they're strong enough to push themselves up 30 times then they're pretty damn strong. Fat people that exercise are usually tolerable anyway.
>>
>>62138453
int add(int a = 5, int b = 3)
{
return a + b;
}

int main()
{
add(); // compiles
int (*fptr)() = add; // does not compile
}


C++ makes me sad
>>
>>62135315
std::function
exists as a high level workaround for this and other shortcomings of function pointers such as inability to use them to store lambdas that contain closure data
>>
>>62138490
std::function is a slow shitty piece of utter garbage
>>
>>62138490
also, decltype(auto) for letting the compiler figure out the type..
>>
>>62138422
Could you provide an example?
>>
>>62138481
>he doesn't know how default arguments work
You make me sad.
>>
>>62138511
I have a better idea now
>>
>>62138508
char* data = read(); //get some bytes from wherever
struct str var = *((struct str*)data); //put them directly into struct
>>
>>62138568
That's a terrible example, you're casting explicitly.
>>
>>62138517
default arguments aren't part of the type.
the language says your function is just an int(int,int) not an int(std::integral_constant<int,5>,std::integral_constant<int,3>) and a int(int,int) at the same time

if you're trying to do something clever, use some templates..
>>
>>62138594
just another needlessly complicated little dead end in c++
>>
>>62138633
someone has to pay the C tax. without it it'd be another dead-end language like D, sadly.
>>
>>62138392
I'm currently using X myself, I understand that its the way(land) of the future but this is really just a learning exercise for me.
>>
>>62127320
>>62127636
>>62127253
Jesus Christ I got BTFO.

Is there any hope for me in CS? Fuck idk why I can't get gud.

Can you guys point me to some supplements at least. Didn't know I was struggling this bad.
>>
seriously, how can I use a variable content in a grep command in then store the output in another variable in bash scripting? I always get "command not found".
>>
>>62138740
is your code patented and you don't want to show it?
>>
File: 1503862830863.jpg (200KB, 1116x896px) Image search: [Google]
1503862830863.jpg
200KB, 1116x896px
>>62136762
pls give example io
>>
>>62138792
i'm trying to hack the US
 var=$(echo "$str" | $(grep -oE '[^ ]+$')) 


i get the output i want but bash treats it like a command
>>
>>62138856
Your commands is strange. I don't understand what you're trying to achieve.
>>
>>62138888
i'm guessing he has a text file containing commands
>>
is ruby/crystal actually any better than java?
>>
>>62138508
sure here's an example
getc returns an int because it's easier on the CPU to return an int than to return a char and also because that way an int value outside the char range can be returned for EOF
C's weak type system makes the following possible:
#include <stdio.h>
#include <stdlib.h>
// result must be freed by caller
// returns empty string if file is empty or already fully read
char *read_until(int delim, FILE *in) {
static int const init_capacity = 8;
char *retval = malloc(init_capacity); // easier than (char *)malloc(init_capacity)
int size = 0, capacity = init_capacity;
for (int c; (c = getc(in)) != delim && c != EOF; retval[size++] = c) // easier than retval[size++] = (char)c
if (size >= capacity) retval = realloc(retval, capacity *= 2); // easier than retval = (char *)realloc(retval, capacity *= 2)
retval = realloc(retval, size + 1); // easier than retval = (char *)realloc(size + 1)
retval[size] = 0; // easier than retval[size] = '\0'
return retval;
}
char *read_line(FILE *in) { return read_until('\n', in); } // easier than read_until((int) '\n', in)
char *read_file(FILE *in) { return read_until(EOF, in); }
int main() {
char *input = read_file(stdin);
puts(input);
free(input); // easier than free((void *)input)
return 0;
}

>inb4 but that's awful
:^)
>>
>>62138888
>>62138920
i want the last word of the string stored in $str, that's what the grep command does

i managed to pass the variable by pipelining the echo (I don't even know if this is a good idea) , but bash gets the output of grep and tries to execute, I want the output to be stored in $var
>>
>>62138962
maybe
eval "$str=$(grep -oE '[^ ]+$')"
>>
>>62138955
>for (int c; (c = getc(in)) != delim && c != EOF; retval[size++] = c)
>if (size >= capacity) retval = realloc(retval, capacity *= 2);
>>
>>62138943
Apples and oranges. Java was invented by smart people to keep stupid people from harming each other, which is different from how most other languages were designed. Ruby was not designed for this and is thus incomparable.
>>
>>62138481
how do fuck it can know fptr expects you to assign 5 and 3 to registers as parameters before calling void function it stores? wht you ask is impossible
>>
>>62138986
I'm totally a retard, the right way to do it is:
=$(echo "$str" | grep -oE '[^ ]+$')

I don't why I tried to wrap grep with $() too, that's why the output was being executed. Thanks anyway
>>
sipser vs the dragon book?
>>
>>62138955
I'm not sure, but this code looks to have many UB points.
>>
File: 1503882284495.jpg (1MB, 500x2855px) Image search: [Google]
1503882284495.jpg
1MB, 500x2855px
Programmer book tiers.
>>
>>62139076
like what?
>>
>>62139099
Like
for (int c; (c = getc(in)) != delim && c != EOF; retval[size++] = c)
>>
>>62139129
what about it's undefined behavior?
>>
>>62139097
more like computer architecture books
>>
I think you guys could get a good laugh out of this
https://www.ijarcsse.com/docs/papers/Volume_3/6_June2013/V3I6-0333.pdf
>>
>>62139186
how do you get that formatting in latex?
>>
>>62139146
Well, OK, it doesn't, I suck cocks.
>>
>>62138943
There are several advantages:
>interfaces, abstract base classes, and singleton classes all in one, via "modules"
module Example
self.def my_utility_method(arg1, arg2)
end
end

>multiple inheritance of modules via "include"
module HasA
def a; end
end
module HasB
def b; end
end
module HasAAndB
include HasA
include HasB
end

>traits / mixins / whatever other term you'd like to use for dynamic multiple inheritance on objects that have already been instantiated, via "extend"
o = Object.new
o.extend HasA
puts o.a

>operator overloading
class PointlessArrayWrapper
def initialize # 'initialize' is always the constructor's name
@contents = []
end
def [](i)
@contents[i]
end
def []=(i, v)
@contents[i] = v
end
def <<(v)
@contents << v
end
end
paw = PointlessArrayWrapper.new
paw << 1
paw << 2
puts paw # [1, 2]
paw[1] = 3
puts paw # [1, 3]

>passing code blocks as arguments using "do ... end" or "{ ... }"
# simply executes the block given
def just_do_it(*args, &block)
block.call(*args)
end
just_do_it do
puts 'i did it'
end
just_do_it(2) do |n|
n.times { puts 'i did it twice' }
end

>using the ability to pass code blocks as arguments to create anonymous classes that can even be stored in local variables because all classes are objects (not merely like in java where classes themselves aren't objects but runtime information about them is available in object form; no, in ruby, the classes themselves are objects)
anonymous_subclass_of_array = Class.new(Array) do
# extra methods or whatever go here
end
thing_that_shouldnt_exist = anonymous_subclass_of_array.new

>closures
def make_a_closure(param)
lambda { param }
end
f = make_a_closure(4)
puts(f.call) # 4
>>
>>62139320
>multiple inheritance
heresy
>>
>>62139320
Oops, that first example should be def self.my_utility_method, not self.def my_utility_method
>>
>>62139338
It's not really multiple inheritance though, its most like composition
>>
>>62139338
Every OOP language has multiple inheritance, it's simply a case of whether or not they cripple it "for your own good"
>>
>>62139349
>Every OOP language has multiple inheritance
false
>>
>>62139320
>>multiple inheritance of modules via "include"
i'm sold
>>
>>62139338
reality is multiple inheritance and programming languages should be as well
>>
>>62139348
This is true, semantically it's more like composition. But syntactically, and for all intents and purposes, it's multiple inheritance. You can call the inherited methods with the same receiver and also override them if you want.
>>
>>62139377
>>62139349
i bet you're another couple that don't even know what multiple inheritance is like the last guy who tried to defend it. at least look it up on wikipedia and make sure you know what it is you're defending before the arg
>>
>>62139377
nani?
>>
>>62139363
which languages have inheritance but not multiple inheritance?
>>
File: Evangelions 261.jpg (64KB, 450x450px) Image search: [Google]
Evangelions 261.jpg
64KB, 450x450px
tfw trying to fix this 10,000 loc monster that mixes c and cpp indistrimently randomly using and not using cpp containers. doesnt use implementation files just shoved everything into .h files randomly uses classes and structs or doesnt at all and used spaces instead of tabs

aaaaaaa
plus it doesnt look like im even doing anything because this dumpster fire already compiles and runs so by 'fixing it' im not actually working
>>
>>62139414
D
>>
>>62139427
Interfaces are multiple inheritance, except crippled
>>
>>62139434
Not really.
And they officially denounce MI.
>>
>>62139447
>inherits from multiple types
>somehow isn't multiple inheritence
>>
>>62139320
Oh, I forgot one:
>dynamic auto-generation of getters and setters, via "attr_reader" (for only a getter), "attr_writer" (for only a setter), and "attr_accessor" (for both); however, you can also define your own if you need to impose restrictions on them
>? and = are allowed in method names, so that boolean getters can end in ? like in lisp, and setters can end in = as if you were just setting a public field
class MyClass
attr_accessor :a
attr_reader :b
attr_writer :c
def initialize(b)
@b = b
end
def print_c
puts @c
end
end
mc = MyClass.new(1)
mc.a = 2 # looks like an assignment method, but actually a call to method "a=" defined by line "attr_accessor :a"
mc.c = 3 # same, but defined by "attr_writer :c"
puts mc.a # looks like a field access, but actually a call to zero-argument method "a" defined by "attr_accessor :a"
puts mc.b # same, but defined by "attr_reader :b"
mc.print_c # no getter for c, so "puts mc.c" would be invalid
>>
>>62139478
interfaces are extremely limited so while it may technically be possible, its not something youd really want to do, due to the caveats.

I really wish they'd just get rid of interfaces altogether though.
>>
>>62139504
oops i meant "looks like an assignment statement" not "looks like an assignment method"
>>
Multiple inheritance is good and Gregor Kiczales is a genius who did everything right. Read AMOP.
>>
>>62138955
C god
>>
>>62139513
You're exactly right. Interfaces are strictly less powerful than classes. That's because the language believes you are too stupid to use full MI responsibly.
A language which insults your intelligence is not a language worth using. Unless you're a fan of Java, anyway.
>>
>>62139504
Oh also you can reopen classes and modules later to add more to their definitions
module FinishLater
def self.do_first_thing
puts 'did the first thing'
end
end
FinishLater.do_first_thing
module FinishLater
def self.do_second_thing
puts 'did the second thing'
end
def self.do_both_things
do_first_thing
do_second_thing
end
end
FinishLater.do_second_thing
# and then do them again
FinishLater.do_both_things
>>
>>62139564
we got a 140 IQ OOPer here. golly i bet you know design patterns like the back of your hand
>>
>>62138363
anybody? Or does no one actually program in this thread
>>
>>62139564
>That's because the language believes you are too stupid to use full MI responsibly.
No, D never treats you like an idiot, this is just one of those things theyve overlooked, or sadly kept due to sepples.

And MI is bad, theres no reason to use it. As the design is inherently bloated and will make your code-base less-manageable and refactorable.

But atleast the actual classes strictly prevent MI.
>>
>>62139586
why would you not use xcb? (outside of targeting wayland..)
>>
So, what's the best version of pascal to use to write a compiler?
>>
>syllabus says you have to break your code into small functions
>under 200 LOC without comments and minimal code repetition
saying fuck it because they'd literally just be void return functions that do part of what main does but i know he's probably going to take marks off because of it. oh well
>>
>>62139602
MI is sometimes the best solution. Mostly only when there's a common base class.
This situation is especially common in OO game programming
>>
>>62139606
The huge amount of documentation of Xlib, but honestly I don't really have a reason to do so or not to do so, I don't have enough experience to make the call at the moment, which is why I'm here looking for advice. So xcb is pretty much strictly better than Xlib aside from documentation?
>>
File: 12742180.png (162KB, 476x260px) Image search: [Google]
12742180.png
162KB, 476x260px
>[1] 23926 segmentation fault (core dumped) ./a.out
>>
>>62139624
its probably to make it easier to grade, and also your gigantic main function is retarded
your main function should be like 5 lines
>>
>>62139602
>D does not treat you like an idiot
>But here is some sepples features, which are bad, but you like them because you like sepples so we'll keep them anyway
>>
>>62139624
prof has the right idea, even void return functions that do part of what main does are worth making functions in their own right if you can see yourself ever using them for any other program
making functions out of large sections of self consistent code that's all related in purpose makes those sections easier to reuse in future situations where they may be applicable
this is also the premise of libraries
>>
File: languagelevels.jpg (715KB, 642x1650px) Image search: [Google]
languagelevels.jpg
715KB, 642x1650px
Why is /dpt/ so obsessed with C when there hasn't been a stable release in over 6 years?
>>
>>62139643
i don't care what 2nd year OOP aficionados think
>>
>>62139629
>This situation is especially common in OO game programming
Just because its the norm doesnt mean it should be encouraged. But the current trend in game dev is de-coupling anyway. Any MI design can be better re-designed to be more open. Especially now that we have tho hardware to start doing a lot of functional design patterns.
>>62139647
No, structs are actually the encouraged way to do things. And you can even use inheritance with those if you wish. We just live in a world where we have to play nice with C and sepples until people finally realize that there are better solutions.
>>
>>62139666
C does everything it needs to already.
It did everything it needed to with C99, arguably C89.
>>
>>62139667
yes you are smarter than your professor, now drop out you obviously dont need educating
>>
>>62139682
it's < 200 lines. i bet you've never actually written anything other than fizzbuzz
>>
>>62139670
>No, structs are actually the encouraged way to do things.
Then why do classes and interfaces exist?
sepples covers all of these cases with a single notion, the class. D neuters and segregates them, for your own safety.
>>
>>62139666
c was perfection since 1980
>>
File: into the sunset.jpg (126KB, 700x500px) Image search: [Google]
into the sunset.jpg
126KB, 700x500px
>>62139666
https://en.wikipedia.org/wiki/Planned_obsolescence#Perceived_obsolescence
>>
>>62139670
I didn't say it was the norm, I said it was the best solution. Other approaches either don't allow for polymorphism or create unwarranted code repetition
>>
>>62139182
Computer architecture books have two tiers: Hennessy-and-Patterson-tier, and pajeet-tier.

>>62139666
>muh innovation
>muh new toys
>muh tendies
You're the reason this art sucks. C is feature-complete. Now piss off.
>>
>>62139695
ive actually written production code you uni twink retard, go back to class and this time pay attention
>>
>>62139696
>Then why do classes and interfaces exist?
To support multiple patterns and be compatible with C/++
>>
>>62139727
>C is feature-complete
No it isn't, idiot.
>>
>>62139727
>C is feature-complete.
Yeah but it sucks.
This is coming from someone who understands it perfectly well.
>>
>>62139757
What is C missing?

I can think of maybe one or two features from sepples, and that's it.
>>
>>62139767
just allow to put functions in structs please and namespaces
>>
>>62139767
It's not missing anything, it's just that all of its implementations of things are bad
>>
>>62139767
>What is C missing?
Memory safety.
>>
>>62139767
modules
>>
>>62139797
C has modules they're called compilation units
>>
>>62139790
Simply epic, my dude.
>>
File: 1502357646102.jpg (177KB, 709x821px) Image search: [Google]
1502357646102.jpg
177KB, 709x821px
>>62139790
Back to your safe space, brainlet.
>>
>>62139642
What am I supposed to understand from this?
Process 25710 launched: '/home/user0/devel/vsc++/a.out' (x86_64)
Enter person name: Aioe
Pancakes Eaten: 11
Process 25710 stopped
* thread #1, name = 'a.out', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
frame #0: libstdc++.so.6`std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&) [inlined] std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_data(this=0x0000000000000000) const at basic_string.h:160
>>
>>62139829
>>62139830
Show me your 100% memory safe C projects, oh you EXPERT PROGRAMMERS.
>>
>>62139790
Modules, pattern matching, lambdas, lazy iterators, UFCS, namespaces etc
>>
>>62139830
You sure love using that image anon.
>>
File: 1368153587111a.jpg (210KB, 552x510px) Image search: [Google]
1368153587111a.jpg
210KB, 552x510px
I have a question... for programmers.

Am I 'correct' in feeling such punishing pressure whenever I look up an answer for a problem whilst learning to program?

What I mean is, do these things come with time? I feel like I can -sort of- easily grasp the concepts, and aside from a few general syntax errors I catch up pretty quickly on understanding a program/how it works/reading code.

Do you experienced programmers continually use resources such as google, books, help etc; when programming at your daily job? I just would like to know how important is the 'research' part in your life as a programmer. Thank you.
>>
>>62139846
Dude, you don't need to be an expert programmer to write a memory safe C project. All you need is to know how to use valgrind.
>>
>>62139730
if you're an application developer that'd explain why your brain's apparently been rotted. if you're claiming to do serious systems programming i don't believe you
>>
File: fsFVbKl.jpg (31KB, 640x480px) Image search: [Google]
fsFVbKl.jpg
31KB, 640x480px
>>62135186
Let me vent
>Doing homework through MyProgrammingLab
>"Do this and that"
>Work towards it, test and run everything using GCC which is the same one we use in class to ensure it's correct
>Submit
>"CODELAB ANALYSIS: LOGICAL ERROR(S) YOUR STANDARD OUTPUT IS NOT WHAT WAS EXPECTED"
>wut
>It shows that I don't have any output, and it's only for this homework
>Spend next 2 hours walking through the code, rewriting and retesting getting the same results from MyProgrammingLab
>Alright fuck this
>Run down to professor's office to talk about it
>Show him several iterations of the code I made, all doing the same thing, then show him how none of these are being accepted
>"Oh well uh I guess you're not using the right compiler then, make sure it's GCC."
>Plead with him to just let me get the points for this homework since I've already demonstrated that I've done it correctly
>"Sorry I can't do that, it wouldn't be fair to the other students since they're also using MyProgrammingLab and aren't running into this problem. It's not that big a deal anyways, don't worry about it."
>my soul when

You just gotta find the middle value of a set of three user input doubles and print them out in ascending order. It's so easy and yet I'm being punished simply because some gay ass website I'm paying money to use won't accept my work. I'm so mad right now I feel like dropping the class entirely.
>>
>>62139867
>a memory safe C project
Doesn't exist
>>
>>62139869
fuck off
>>
>>62139848
>Modules
compilation units
>pattern matching
not a real programming feature
>lambdas
exported pointers to file-static named functions
>lazy iterators
literally just pointers
>UFCS
macros
>namespaces
compilation units
>>
>>62139846
https://github.com/systemd/systemd.git
>>
>>62139767
can i have function overloading please
>>
>>62139877
it's trivial
int main() { return 0; }
>>
>>62139886
7/10 on mental gymnastics, 6/10 in reply quality, 10/10 on enthusiasm
>>
>>62139866
If you're doing problems from some programming literature then previous chapter(s) should give you all the info you need to solve the problem. So you are correct.
>>
>>62139866
>Am I 'correct' in feeling such punishing pressure whenever I look up an answer for a problem whilst learning to program?

no
you are `stupid'

of course you look up stuff constantly dumbass
not having to look up syntax and little tricks is not a prerequisite of becoming a (good) programmer, but a consequence of it
>>
>>62139899
macros
>>
>>62139886
Sad, you are just as stupid as pytoddlers
>>
>>62139918
That's not C
>>
File: ctards.jpg (29KB, 500x500px) Image search: [Google]
ctards.jpg
29KB, 500x500px
>>62139886
>>
heres a fun game
someone ask me for a feature for C and ill just reply "its turing compete implement it yourself retard"
>>
>>62139773
>functions in structs
You can. Lern2declaration.
>namespaces
Prefixing.

>>62139890
ebin

>>62139875
Part of the software development process is interacting with shitty vendors. You should file a ticket with MyProgrammingLab.
>>
>>62139958
I'll ask you to get some brains first.
>>
>>62139866
Yes, you always look stuff up. Part of being a good programmer is being able to look stuff up quickly and efficiently.
>>
>>62139958
dude just implement yourself lmao it's all just pointers xd
>>
heres a fun game
someone ask me for a feature for sepples and ill just reply "its turing compete implement it yourself retard"
>>
heres a fun game
someone ask me for a feature for regular expressions and ill just
oh wait never mind
>>
>>62139992
Modules, UFCS, Hygienic macros, pattern matching and a standard build system
>>
>>62139840
its telling you have a nullptr as a string somewhere after 11 pancakes were eaten..
you could load it with gdb and debug it.

>>62139902
>assuming the c runtime thats going to execute that doesn't have any memory safety errors.
or do you really think thats the real entry point for your program?
>>
File: comfy.png (280KB, 1922x1009px) Image search: [Google]
comfy.png
280KB, 1922x1009px
Who's environment is /comfy/? I'm programming in C using the vis text editor, both are super /comfy/ to program in. Share comfy environments.
>>
>>62140013
its turing compete implement it yourself retard
>>
>>62140013
>Modules
compilation units
>UFCS
macros
>Hygienic macros
not a real programming feature
>pattern matching
not a real programming feature
>a standard build system
definitely not a real programming feature considering building is not even a part of a programming language in the general case
>>
>>62140021
looks like poop
change your colourscheme and alias your font
>>
>>62139970
>Part of the software development process is interacting with shitty vendors.
Well I guess that's something to remember as I go through college. I'll see if I can direct my complaints to MyProgrammingLab but I really hate how my teacher blew me off like that, it felt like he didn't even care. I'll be even madder if I found out other people actually have been getting the same problem as me with the site.
>>
>>62140018
>>assuming the c runtime thats going to execute that doesn't have any memory safety errors.
why would i assume that
also why would i assume the c runtime that's going to execute is part of the c project i'm asserting is memory safe (it's not)
>>
File: sepplestards.jpg (47KB, 500x500px) Image search: [Google]
sepplestards.jpg
47KB, 500x500px
>>62140034
>>
>>62138422
>C's static type system is deliberately weak to allow for low level shenanigans
What a great way to invoke UB.
And no, it doesn't somehow make low level programming "easier".
>>
>>62138955
>
// returns empty string

>Pretending C has strings
>>
>>62140138
A string is a null-terminated character array
C has character arrays
C has the null character
C has the necessary facilities to treat a character array as being terminated by a null character
Therefore C has strings
>>
is the null terminated char array thing the most retarded feature of any "programming language" ever devised??
>>
>>62140013
>hygienic macros
>t.ceiling cat
>>
what's dpt's opinion on visual studio code?

honestly i still like visual studio 2017 for my largest projects

visual studio code seems like it's aimed at smaller coding projects, which i wouldn't mind having a quick scripting thing that comes with my larger project manager
>>
>>62140181
considering that's what strings are, no
>>
>>62140185
Theres really no reason why VSC can't manage the same project scope as VS.
The built-in git stuff is also nice.
VSC > VS > your TE
>>
>>62140181
less retarded than O(n) string access
>>
Isn't CMakeAutismLists.txt enough for hating on C/C++?

Remind me if there is any better build system for those two languages from the past.
>>
>>62140155
First of all, you start with the assumption that strings are null terminated.
No, they are not always, and only the shit string implementations are null terminated.

Second, C's """arrays""" decay to pointers, so when you're passing your so called """strings""" to functions, you're actually just passing a pointer with the assumption that if you linearly traverse the pointer, you may come across a null terminator.
C's type system is so shit that it's users just assume that char* usually points to multiple chars instead of 1 and only 1.

Real, proper strings are not null terminated. They are their own type, they have a length field, they PRESERVE their length, and they have operations defined on them.
>>
>>62140205
you replied too fast to not be a shill tbqh famalam
>>
 for while time do double
>>
File: 4fb.jpg (66KB, 680x680px) Image search: [Google]
4fb.jpg
66KB, 680x680px
How does one achieve coding Nirvana?
>>
>>62140245
>no true string fallacy.
C doesn't have $LANG idea of strings because C is not $LANG.
in C, a string is a null terminated char array.
in C, a string could be a linked list, or any other data structure. but <string.h> assumes the former. so calling anything that doesn't fit this defintion a string is incorrect. thus, stringbuffer, bstring, etc have been made.

(also strings are ropes in real languages. :^))
>>
>>62140320
to start it's called programming, not coding
>>
File: Maki 224.jpg (806KB, 2452x3540px) Image search: [Google]
Maki 224.jpg
806KB, 2452x3540px
>>62140323
char * is a shitty hack
>>
>>62136762
What the fuck I've done
#include <math.h>

#define CARRY(F1, F2, NUMBER) \
if (result.F1 >= NUMBER) {\
result.F2 = result.F1 / NUMBER;\
result.F1 -= NUMBER;\
}

#define BORROW(F1, F2, NUMBER) \
if (result.F1 < 0) {\
result.F2--;\
result.F1 += NUMBER;\
}


#define SWAP_LSD(DST, SRC) \
DST.sign = SRC.sign; \
DST.l = SRC.l; \
DST.s = SRC.s; \
DST.d = SRC.d; \
DST.f = SRC.f;

#define CLEAR_LSD(X) \
X.sign = 0; X.l = 0; X.s = 0; X.d = 0; X.f = 0;

#define SET_LSD(NAME, SIGN, L, S, D, F) \
NAME.sign = SIGN; NAME.l = L; NAME.s = S; NAME.d = D; NAME.f = F;

typedef struct lsd {
unsigned char sign;
int l;
int s;
int d;
int f;
} lsd;

lsd sub_lsd(lsd arg1, lsd arg2);
lsd from_f(long farthings);

lsd add_lsd(lsd arg1, lsd arg2) {
lsd result;
CLEAR_LSD(result);

if (!!arg1.sign ^ !!arg2.sign) {
result = sub_lsd(arg1, arg2);
goto end_add;
}

result.f = arg1.f + arg2.f;
CARRY(f, d, 4);
/*
if (result.f >= 4) {
result.d = result.f / 4;
}
*/

result.d += arg1.d + arg2.d;
CARRY(d, s, 12);

result.s += arg1.s + arg2.s;
CARRY(s, l, 20);

result.l += arg1.l + arg2.l;

end_add:
return result;
}
>>
After painful months of floundering, I finally got my penis detection neural network to work!
Example results can be found here: http://imgur.com/a/fIny1
The dawn of automatic decensored hentai draws closer.
>>
>>62140245
>First of all, you start with the assumption that strings are null terminated.
>No, they are not always, and only the shit string implementations are null terminated.
No, it's actually a good implementation.
>Second, C's """arrays""" decay to pointers, so when you're passing your so called """strings""" to functions, you're actually just passing a pointer
To the array.
Ergo you're passing the array.
By pointer.
>with the assumption that if you linearly traverse the pointer, you may come across a null terminator.
This assumption is well documented in library functions. The documentation makes this assumption a part of the language specifications. If you linearly traverse the pointer, you WILL come across a null terminator, or else it's not a string, and IF you DO, then it is.
>C's type system is so shit that it's users just assume that char* usually points to multiple chars instead of 1 and only 1.
Unrelated. A string containing 1 and only 1 character is a valid string so long as that character is '\0'. If not, it's not a valid string. It's perfectly valid for char *s to not be valid strings, so long as you don't pass them to string functions.
>Real, proper strings are not null terminated.
Correction: your preferred implementation of strings is not null terminated.
>They are their own type, they have a length field, they PRESERVE their length,
See above. These are not necessary qualities for something to be a string.
>and they have operations defined on them.
string.h
stdio.h
>>
>>62140379
im impressed i didnt think you would ever get it to work
>>
>>62140371
>What the fuck I've done
Embarrassment.
>>
>>62140245
>they have a length field,
literally a waste of space
>>
>>62140259
ill shill whatever software i like.
besides its FOSS.
>>
>>62140386
wow c is amazing it can do polymorphism without informing you just by changing a single byte in an array and totally break everything
>>
>>62140409
one byte for your null terminator or one byte for length field :thinking:
>>
>>62140371
>>62140393
It's not the end
int cmp_lsd(lsd arg1, lsd arg2) {
int result;
result = 0;

if (!!arg1.sign ^ !!arg2.sign) goto dif_signs;
if (arg1.l != arg2.l) result = ((arg1.l > arg2.l) ? 1 : -1 );
else if (arg1.s != arg2.s) result = ((arg1.s > arg2.s) ? 1 : -1 );
else if (arg1.d != arg2.d) result = ((arg1.d > arg2.d) ? 1 : -1 );
else if (arg1.f != arg2.f) result = ((arg1.f > arg2.f) ? 1 : -1 );

result *= 1-2*(!!arg1.sign);
return result;

dif_signs:

result = !!arg2.sign - !!arg1.sign;
return result;

}

lsd sub_lsd(lsd arg1, lsd arg2) {
lsd result;
CLEAR_LSD(result);

if (!(cmp_lsd(arg1, arg2)+1)) {
SWAP_LSD(result, arg1);
SWAP_LSD(arg1, arg2);
SWAP_LSD(arg2, result);
CLEAR_LSD(result);
result.sign = !result.sign;
}

if (!!arg1.sign ^ !!arg2.sign) {
arg2.sign = !arg2.sign;
result = add_lsd(arg1, arg2);
goto end_sub;
}

result.f = arg1.f - arg2.f;
BORROW(f, d, 4);

result.d += arg1.d - arg2.d;
BORROW(d, s, 12);

result.s += arg1.s - arg2.s;
BORROW(s, l, 20);

result.l += arg1.l - arg2.l;

end_sub:
return result;
}
>>
>>62140414
Yes.
You can remove the sentinel value in an array and algorithms that depend on a sentinel value to determine the end of the array will no longer work.
Why is this surprising?
Why is this a bad thing?
>>
>>62140371
>>62140431
End
lsd mul_lsd(lsd arg1, float arg2) {

lsd result;
long farthings;

CLEAR_LSD(result);

farthings = ((arg1.l) * 960) + ((arg1.s) * 48) + ((arg1.d) * 4)+(arg1.f);
farthings *= fabs(arg2);


result = from_f(farthings);
result.sign = !((arg2 / abs(arg2)) + 1) ^ !!arg1.sign;

return result;
}

lsd div_lsd(lsd arg1, float arg2) {

lsd result;
long farthings;

CLEAR_LSD(result);

farthings = ((arg1.l) * 960) + ((arg1.s) * 48) + ((arg1.d) * 4)+(arg1.f);
farthings /= fabs(arg2);


result = from_f(farthings);
result.sign = !((arg2 / abs(arg2)) + 1) ^ !!arg1.sign;

return result;
}

lsd from_f(long farthings) {

lsd result;

result.l = farthings / 960;
farthings %= 960;
result.s = farthings / 48;
farthings %= 48;
result.d = farthings / 4;
farthings %= 4;
result.f = farthings;

return result;
}
>>
>>62140426
>one byte for length field
you mean eight bytes for length field
so yeah one byte for null terminator is clearly the more conservative choice because 1 < 8
>>
>>62140442
WHAT A SHITTY LANGUAGE
>>
>>62140447
oh well and there's an error with abs instead of fabs
>>
>>62140455
Why though?
In ANY language, if an algorithm depends on a sentinel value, and you remove the sentinel value, the algorithm won't work.
>>
>>62140465
It's okay, no one expects a bugfree C program anyway
>>
Why doesn't anyone here discuss Fortran? The first original high level language.
>>
>>62137306
I like Scala (former Java developer). Sometimes is horrible (I'm not going to lie) but once you get the knack of it, is very elegant, has seamless integration with Java, works great in IntelliJ, is fast.
Couple of things I don't like: it's virtually imposible to work in it without an IDE. Compilation is slow for large codebases
>>
>>62140486
once i wrote a program in fortran
i ran it on the only machine old enough to run it: an ancient mechanical stronghold
unfortunately soon after i ran it my fortran off without me
>>
File: Fortran.jpg (29KB, 350x427px) Image search: [Google]
Fortran.jpg
29KB, 350x427px
>>62140486
>>
>>62140450
>He says as he doesn't consider the cost of taking the length of either strings.
>>
>>62140581
>taking the length
>ever
>>
>>62140220

Name a better build system for any other language. CMake is flexible, and isn't as verbose as all of those XML-based build systems floating around.
>>
your main functions should be ~5 lines. you shouldn't be doing any logic in main. no excuses.
>>
>>62140643
>Name a better build system for any other language.
gmake
>>
>>62140643
>Name a better build system for any other language
literally any language with a package manager
cargo,stack, dub etc
>>
>>62140650
disagree, putting literally everything in main without defining any other functions at all is a legitimate coding style
>>
>>62140674
I
AM
THE
COMPILER
>>
>>62140674
you're an idiot if you do that. all programs written in C have not used main. main is just a vessel. procedural code should be broken into different void functions so that you have to scroll around like a tarantino movie instead of seeing what the program does in sequence. you should write even the most trivial C program like a java program
>>
>>62140674
This brings a new meaning to the expression "linear programming".
>>
>>62140685
it's true though
consider the overhead of calling a non-inline function
you have to push a stack frame when you call it and pop the stack frame when it terminates
consider the overhead of calling even an inline function
you pollute the namespace
consider the overhead of calling even a static inline function
you pollute the static namespace
much better policy to just put everything in main always
>>
>>62140656
Not as robust.

>>62140662
Package management is not the job of a build system. The job of a build system is to make it easy to specify how a program should be built.
>>
>>62135186
A disassembly and hooking engine
>>
File: ftfy.png (199KB, 1692x700px) Image search: [Google]
ftfy.png
199KB, 1692x700px
>>
>>62140708
>The job of a build system is to make it easy to specify how a program should be built. Managing what goes in to your program is part of building. And any package manager should come with a streamlined config where its more about options and less actual meta-programming.
>>
>>62140705
Why use loops when you can just paste the code 20 times?
Consider the overhead of branching after each pass

(jokes aside, if you write your loop like a retard the overhead of branch mispredicts can be quite big)
>>
>>62140698
what if you just put it all on one line that way you never have to scroll at all

>>62140698
you should write all your trivial code you make in uni as shitty and hacky as possible, why learn. its not like the trivial code is actually practice for real code in the future...

i guess they can jus thire you as the trivial code guy, you can write all the libraries with just one function with every feature crammed into it, because everyone hates tarrantino moveis am i right
>>
>>62140705
#include <stdio.h>

/* function: printHelloWorld
Description: prints "Hello, world!" to standard output, and then returns void.
Arguments: None.
Returns: void.
*/
void printHelloWorld(){
puts("Hello, world!")
return;
}
void main(){
printHelloWorld();
return;
}


if only i could put the return call in a function..
>>
>>62140732
No golang?
>>
>>62140756
this is not a problem in ruby
return_from_caller = Proc.new { return }
doesnt_return_four = lambda { return_from_caller.(); return 4 }
not_four = doesnt_return_four.()
puts not_four
>>
>>62140756
the funny thing is he's actually advocating that
>>
>>62140756
in what world does that compile as C
>>
>>62140756
This is the obviously right way to do it, everything else is shit tier.
#include <stdio.h>

const char* hw = " !dlrow ,olleH";
int main(int ind)
{
if(*(hw+ind)) main(ind+1);
putchar(*(hw+ind));
}
>>
>>62140842
better make some unit tests like my java shop profs told me!
>>
>>62140868
That.s some functional C
>>
>>62140705
>what is -flto
>>
>>62140868
why are you doing logic in main?
>>
>>62140746
Consider
-funroll-loops
>>
>>62140868
Wow, didn't know you could call main from main, neat
>>
>>62140916
-fpeel-loops
too (well, somewhat)
But I think his point was you shouldn't write that explicitly.
>>
>>62140868
What did he mean by this?
>>
New thread:

>>62140954
>>62140954
>>62140954
>>
>>62137306
The problem with Scala is that in order to write good Scala one must know how to write Haskell(-like) or at least another ML derivative.

By compromising on paradigm to cater to POO devs, this group is never forced into learning how to approach things functionally.

F# gets closer due to how the community approaches it and being essentially OCaml.NET, but many devs still seem to miss the mark with it.
Thread posts: 315
Thread images: 36


[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.