/dpt/ - Daily Programming Thread

Last thread: What are you working on, Sup Forums?

Other urls found in this thread:

play.google.com/store/apps/details?id=net.beecoded.calcurain2
twitter.com/SFWRedditVideos

First for traps are women.

programing gay xddddddd
d

Trans women are non-biological females.

First for non-biological "female" programmers.

>t. non-biological feminine ladylike

4th for*
You easily-baited Sup Forums types can't even count.

Are overflows in left bitshifts for unsigned types well defined in C?

>4th
>can't even count

is Laravel worth learning for web development in 2018?

Why should I learn/use C over C++ if I intend to work with general software development and not in a computer engineering role.

I don't want to know the "differences" between the two, there's plenty of content about that on the internet and that's not what I'm asking. I want to know why C would be superior in that scenario, if it is at all.

pic unrelated.

There are basically no good styles for writing C++ - every one is broken and bad for some reason or another.
It's much easier to get a team to agree on what good C looks like.

>le Sup Forums boogeyman
You're trying to redefine biological terms now. Calling you a retard isn't Sup Forums-related.

>Laravel
fuck off, this is /dpt/.

>not realizing what easily-baited means.
>is still being baited, even without posts to bait him

>falling for obvious bait

>greentexting "falling for obvious bait"
>when in fact it is you who has fallen for the bait
Traps aren't gay.

>falling for obvious bait

>not realizing what Sup Forums means
>is still being baited by my masterful responses
>will confirm his status as a baitee by directly or indirectly responding to this post

i've finally started on my game. i'm writing it in C. first i am working on a basic dungeon library.

Use Rust.

I'd rather spend my time writing code rather than appeasing the borrow checker.

Failure to appease the borrowchecker basically means you have a bug. Rust doesn't compile programs that produce incorrect results, and if your program doesn't compile, that means it produces incorrect results (or is outright nonsense).

when compiling with gcc, should I put the optimization flag in the compilation command or in linking command?
If it's only possible to put the flag in compilation, what is the best practice to separate the optimized and unoptimized object-file?

Compilation. Typically no optimization is done in the linking phase (LTO does exist for this, but it's something else you'll have to read up on).

tool idea: command line google. enter your query, it returns a list of sites and a blurb, you enter the number you want and it then spits out the web page's text at you. to make googling a lot less time consuming when you're working on the terminal

c++ is the greatest language of all time

Would someone like to test my game and give me honest feedback good/bad or any suggestion?
everything is legit, ill post its google play link

Professional gamer here. Post link.

Is raising an exception a side-effect ?

generally yes

>generally
So if I catch it in the calling function it isn't ?

also what about completely terminating the program could that be considered a sife-effect?

no

play.google.com/store/apps/details?id=net.beecoded.calcurain2

Better question, can and should it be used as part of flow control?

How do I split a string in C++?

Rust dude, I have a question.
Is there any way to remove the Box type from this method?
#[allow(needless_pass_by_value)]
pub fn error(&mut self, err: Box) -> Result {
write!(
self.stdout,
"{}{}{}",
clear::All,
cursor::Goto(1, 1),
err.description()
)?;

self.stdout.flush()?;

Ok(())
}

A string, a char* or some other type?

if you just need one or two parts you can do mystring.substr(begin,end)
if you need to split on every comma or something, put that in a function and loop, using mystring.find(',', previous comma) to locate the next comma

this

boost::split

Error is an (unsized) trait type so it must be accessed through some kind of reference.

>learn/use
If you want to learn C++, learn C before. It is a much simpler language, and you will learn manual memory management which is a big deal in both languages. C++ is basically C with a dizzying amount of additional features anyway. But if you start coding like in Java, and throw 'new' everywhere in C++, you are bound to have bad surprises.

When it comes, you can use both according to your taste and the problem at end, but if you code in C++ a bit in your life, you will probably end up using a C library at some point anyway and mix the two seamlessly.

>not supporting iphones
Sorry, Rajesh. I can't help you.

shit meant, **when it comes to use**

>not supporting iphones
ios will be ready soon

Take an &Error instead.

I take that as a no. Shame though, I wanted to remove the allow lint option because it generates a warning when compiling on stable.

Thanks user, it works. It's weird though. I could've sworn that it didn't work previously. I guess I was a bit tired back then.

Just finished this tiny Fortran module. Its subroutine produces a simple text header from its only input argument.

module utilities
implicit none

contains

! Print a centered, simple stylized text header.
subroutine PrintHeader(sTitle)
implicit none
character (len=*), intent(in) :: sTitle

! Format string
character (len=*), parameter :: f_header = &
'(5(''-'', 1x),(a),5(1x, ''-''))'

write (*, fmt=f_header), sTitle

end subroutine

end module utilities

>FORTRAN
what's your endgame?

Should I learn Perl 6 as my first language?

Last question Rust furenzu:
I have this enum, but I cannot get it to work:
#[derive(Debug)]
pub enum Key {
char,
}

I get the following error while pattern matching on the enum:
error[E0308]: mismatched types
--> src/main.rs:41:13
|
41 | 'q' => true,
| ^^^ expected enum `input::Key`, found char
|
= note: expected type `input::Key`
found type `char`

Dont listen to retards like Learning C before C++ is like learning how the car engine works to the smallest detail when you only need to learn how to drive. Knowing those kind of details of C is great but for most C++ projects its unneeded because C++ has an abstraction layer that deal with all that and it does it well.
Learning C if you dont need it simply a waste of time.

Still writing unit tests for my C++ webserver framework. Thank fuck I remembered libcurl exists, I was going to try some hacky socket shit to sent simple test requests. I'll probably still have to do that to check the parser, but I don't want to think about that right now.

Just to enjoy modern old-fashioned programming

I know basic C++ already and have a general understanding of pointers and memory allocation, and classes/inheritance. I've also used C# extensively, albeit in a very unprofessional way (Unity amateur game development).

What it feels like, as someone who hasn't used either language in a structured project, is that they're pretty much interchangable, with C++ having thrown a huge amount of abstractions over the basic core of C. What isn't clear to me is how those abstractions are beneficial and to what extent they're necessary for someone to be productive.

First for Erlang.

Functional programming is the future.

(You)

If you are already comfortable with Java or another language, it takes a couple of weeks to learn enough C to make a non-trivial program, and I believe it gives you a good basis to understand with there are * and & everywhere in C++ code.

she's cute

You will get better results on Sup Forumsagdg

This would be very trivial to do in python, or even C with libcurl

bls respond, should I learn perl 5 or 6? I understand they are totally different languages but which would be better if I'm not maintaining legacy systems?

Thats just very basic babby tier understanding of C. I dont consider that to be a result of 'learning C'.

Probably perl6, since it's newer and cool

just working on a security system

Dude, learn the difference between an enum and a struct. An enum is an "enumerated value". You can say Key::char, but not Key::'q' - that doesn't make any sense.
If you want to store a single character, the easiest way is to do something like Key(char), which is a tuple struct where you can do this:

#[derive(Debug)]
pub struct Key(char);

fn match_character(key: &Key) -> bool {
match key.0 {
'q' => true,
_ => false,
}
}

That girl (male) programs in Haskell, actually.

Whatever, just use whatever you like, C++ or C, I don't give a fuck, they are both useful languages and part of an ubiquitous ecosystem for writing shit that have to go fast. If you know one, you should end up knowing at least a bit of the other one after a while anyway.

Such beauty would never touch a turd like haskell

How to make a reverse .gitignore?

.gitinclude

Just found out that someone from my school is posting here, he asked for help for a specific (piss easy) assignment we had to do, this disgusts me.

.gitnoticeme

I am getting back into webdev after more than 3 years and damn. Kids these days have it so easy. There new css features and shit are so cool.
I remember being force to use disgusting hacks to get the page display same in all browsers and now everything just werks.
And whats up with all these faggot framworks for everything all over the place? Do people actually use those? Like why? It's fucking web dev, not assembly

what was the assignment? fizzbuzz?

>underage detected
You have to be 18 to post here
Reported

Ok, using Java, trying to set 6 dnd attributes in constructor called setstats with parameters of player type. Made array in constructor method that contains each attribute so could say: for each attribute, roll my dice object 4 times discard the lowest and attribute will equal the roll. But I create player, put it in param for setstats the call printstats method and none of the attributes are set.

>only children can have an education!!
Kill yourself, you massive brainlet. Some of us can afford to go to uni.

>literal definition of screenshot

when did you drop out of school, user? CS assignments are a thing in college.

Its too late now, you should have studied for your test before hand. There is no point helping you, even if you pass you will be just another code monkey

Jesus Christ

are you literally 12?

Maybe in a year or two when you finish your school. Until that time fuck off

...

Holy fuck. I'm writing a webscraper with bs4 and all the code is literally spaghetti.
So much splitting of lists and subindexing to get useless puncuations off and joining it back together just to get datetime from a title attribute.

I started programming last year of middle school.

>underage detected
You have to be 18 to post here
Reported

are you retarded? just use a regex

Windows programmers pls help

The notification bar in Windows 10(opens when you press the message box in bottom right corner or swipe) is largely unused and I'd like to actually use it for shit I need.

>calculator
>stats line CPU load, memory, disk, up/down
>agenda maybe

Is this possible? I don't really know the spec for designing win32 shit but this Bash for windows thing has me hooked now. Surely it can be done right? I can use C#, C and Python.

fuck off, fag

Custom errors, also Madness

how retarded are you on a scale of 10 to

I am 28

actually, that's a good idea.
for some reason i thought you're suggesting me to regex the whole html

You mean *this

>regex
>html
shh you'll wake (him)

Sure you're "28" and you don't even know what CS schools are.

Daily Programming Club!