[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: 319
Thread images: 35

File: before_after.jpg (206KB, 700x671px) Image search: [Google]
before_after.jpg
206KB, 700x671px
What's in the box, /g/?
Old thread: >>60578271
>>
First for redblack tree, the cutest amongst selfbalancing
>>
>>60580178
First for fuck FP purist whiners.
>>
>>60580178
>What's in the box
pussy
>>
>>60580144
Yeah I know this feeling. When nobody gives you attention unless you mention that you have a relatively good job. Its like there's only bottom of the barrel gold diggers out there for you.
>>
>>60580189
Do you mean AVL?
>>
File: 1490742212255.gif (2MB, 540x228px) Image search: [Google]
1490742212255.gif
2MB, 540x228px
C influenced languages get an automatic F in my book.
>>
>>60580219
Why are you posting that whore?

>C influenced languages get an automatic F in my book.
Good thing nobody cares about your book, huhuhu
>>
tfw
error: C++ style comments are not allowed in ISO C90
//
>>
NO SHITPOSTING BELOW THIS LINE

_____________________
>>
>>60580273
Good, // comments are cancerous.
>>
File: anal beads.png (117KB, 767x1855px) Image search: [Google]
anal beads.png
117KB, 767x1855px
>>60580276
>/g/ is a slow board you idiot

Objectively false.
>>
>>60580287
I respectfully disagree. Last time I tried commenting out a section of code, the following happened:
before:
blablah somecode;
while (ttt) { /* helpful comment */
foobarspamegg
}
things;

I wanted to shut up the loop so I put comment markers around it and...
blablah somecode;
/*
while (ttt) { /* helpful comment */
foobarspamegg
}
*/
things;

MOTHERFUCKERS DON'T NEST! At least so called C++ comments do for fuck's sake!
>>
>>60580353
When are you going to put up your fork on github you lazy fuck
>>
>>60580361
#if 0
#endif
>>
>>60580361
I don't understand why comments wouldn't nest. It's easy and very cheap to implement. And I don't see the drawbacks.
>>
>>60580362
I've been working during the day, and drinking at night, mate. Someday soon, I hope.

It's mostly a caching issue at this point. I want to implement different methods for forcing fresh data or being fine with data cached with a set expiration time.
>>
>>60580372
Yeah why not. I'll remember that.

>>60580376
Agreed, I intuitively assumed they did, but apparently they don't. Gotta check the standard, brb.
>>
>>60580376
They do in ocaml.
>>
File: dlang_chan.jpg (139KB, 470x545px) Image search: [Google]
dlang_chan.jpg
139KB, 470x545px
Threadly reminder that dlang-chan is not dead; she's going to have her GC tumor removed (eventually); and she's super duper cute and easy to prototype in! Say something nice about her, /dpt/!

>>60580205
>3DPD
>>
>>60580378
By the way, is chinkm00t blocking requests without an user agent now or is it just me?
>>
>>60580404
I had no issue running that code just now in the normal manner.

If your requests are brittle, you might get an exception.
>>
>>60580403
Threadly reminder that you need to rethink your life.
>>
>>60580406
Weird, the imgboard.php & the posting endpoints now return 403 without an user agent
>>
File: nested.png (6KB, 312x115px) Image search: [Google]
nested.png
6KB, 312x115px
>>60580403
feels good man.
>>
>>60580421
Oh, I'm not attempting any posts at this point. My motivations are data analytics-based; I'm intending to set up a system that regularly caches post data in a way that I can analyze sentiment and other qualitative metrics of posts over time.
>>
>>60580447
Would you be interested on adding a posting component though? I could help if you put it on github
>>
I finished my one day project. I certainly enjoyed making it, although if anyone has suggestions for better C# argument parsers I would love to know because fuck both the one I used and the one I dropped.

https://github.com/Booom3/Image-Comparer
>>
Should I learn android development with java or kotlin?
>>
File: 1495120695900.jpg (41KB, 640x480px) Image search: [Google]
1495120695900.jpg
41KB, 640x480px
>>60580555
>Booom3
>>
Imagine a /dpt/ without anime, autism and faggotry
>>
>>60580630
>imagine 4chan without anime
it's called reddit
>>
File: 1485895481547.jpg (22KB, 351x351px) Image search: [Google]
1485895481547.jpg
22KB, 351x351px
>>60580555
>
for (
int x = bounds.x;
x < bounds.w;
x++
)
>>
>>60580667
it's beautiful
>>
>>60580667
>redeclaring var type every loop cycle
it's like you don't care about performace
>>
>>60580779
Fuck off with your retarded tricks that don't matter
>>
>>60580178
His dick
>>
File: sad.png (78KB, 412x351px) Image search: [Google]
sad.png
78KB, 412x351px
>tfw finish assignment about recursion but didn't do it on purpose
>>
Types are overrated
>>
>>60580831
Without using recursion you mean? Noice. Not very academic, but quite classy. Personally I do my Java homework with SoA and dynamic typing, to each their guilty pleasures.
>>
>>60580779
Nope, read it again.
>>
>>60580667
Oh yeah that's just a leftover from when those lines were significantly longer. Looks glorious now though.
>>
>>60580876 : Faggot
>>
Reposting from /wdg/.

My job is shit, I'm quitting, I have enough money to stay at home learning something on my own for a while.

Web dev or coding for landing a job and making money?
>>
>>60581178
Both are pretty good afaik, depends on if you enjoy design or logic more.
>>
>>60580831
dumb frogposter
>>
Last night, I put together a PRAW bot to mass downvote submissions and comments of a given Reddit user. I even fancied it up with a Tkinter UI. However, the Stack Exchange crowd didn't care much for it. "Malicious" and "against Reddit policy" got thrown around. I thought it was "Code Review" not "Ethics Review", but whatever.

Anyway, what would be a good serious project to start up on? I've built endless amounts of web scrapers, small scale web servers, web pages, system applications like notepad, media players, etc. But I want to pour my time into something a bit larger and with a more serious goal. Any ideas for an intermediate programmer?
>>
>>60581308
Write a C compiler
>>
>>60581339
I actually am not a C guy. I know Python, Ruby, Java, and Javascript. Though, jumping ship to C# wouldn't be terrible. I could also write a Java compiler, no? What is the purpose of reinventing a compiler? What skills would I gain from that? Thanks for the suggestion.
>>
>>60581376
>I know Python, Ruby, Java, and Javascript
You're not an intermediate programmer then
Go learn something lower level
>>
>>60580555
why c#?
>>
can c++ programs take the screen as input and then output key presses
>>
>>60581413
It's the language I know best.
>>
>>60581395
Oh, my apologies, I didn't know that my experience in making programs came from what language I used, instead of simply writing code. Why are you refusing to offer projects for those languages? I have taken a couple C classes in school, and have written quite a few programs in it, but chose other languages to develop in.

Maybe offer some suggestions for me to improve instead of just calling me out?
>>
File: 1494851263619.jpg (33KB, 452x456px) Image search: [Google]
1494851263619.jpg
33KB, 452x456px
>>60581498
>Maybe offer some suggestions for me to improve instead of just calling me out?
That's what I did. Go learn something lower level to understand how a computer really works.
>>
>>60581376
>Java compiler
>>
>>60581489
You're writing it like C++ or Java, not using any of the sugar that makes C# enjoyable to use.
>>
>>60581564
That's true, I have spent the last year and a half writing Node.JS and just regular JavaScript. I have forgotten a lot of the real neat shit about C#.

Anywhere I can get up to date quickly?
>>
>>60581602
https://learnxinyminutes.com/docs/csharp/
>>
>programming
>suddenly get a boner
wtf
how do I cope with this shit
>>
>>60581564
Are you referring to the new 6 & 7 C# features? Maybe he wanted to keep compatibility with older VS versions
>>
>>60581732
wear a chastity cage
>>
>>60581544
No, what you did was ignore my original question and offer bullshit. My six ITS certs give me a comfy understanding of hardware and firmware. I know some assembly stuff as well.

I was asking for programming projects in some relation to my current skill-base.

Your solution read like: "Hey, I know you're an active programmer using some of the industries top-used languages, and your question was asking for projects possibly related to said languages, but instead I'm going to offer the idea that you should ditch those interests and pursue an entirely different language that you have already worked with in college, but maybe this time you should really go deep with it. Otherwise, give up on being a real programmer."

Man, I was just looking for more serious side-projects to work on. My job has me developing software for a medical information system, which is cool and all, but I wanted to see if you guys had any ideas of what I could write, at home, as a more involved project. Instead, I got shit.

Oh well, back to the Stack Exchange / Reddit. At least the levels of glorified smart-ass are a bit lower on those sites.
>>
>>60581822
You'll fit right into reddit because here we don't reply to bait.
>>
File: 1488143910221.jpg (48KB, 330x319px) Image search: [Google]
1488143910221.jpg
48KB, 330x319px
>>60581822
Jesus fucking christ, just fuck off to r*ddit
Nobody's gonna read your butthurt paragraphs for every shitpost you respond to
>>
>>60581822
Saved
>>
rate my haskell http server!
{-# LANGUAGE OverloadedStrings #-}

import Network.Wai.Handler.Warp (run)
import Network.Wai (Application, responseLBS)
import Network.HTTP.Types.Status (status200)

import qualified Data.ByteString as BS

main :: IO ()
main = do
putStrLn "Starting Server!"
run 8000 app

app :: Application
app req respond = do
putStrLn ("Got Request: " ++ (show req))
let response = responseLBS status200 [] "Hello World!"
putStrLn "Sending Response..."
respond response
>>
>>60581905
>import

You didn't write anything.
>>
>>60581308
>I've built endless amounts of web scrapers, small scale web servers, web pages,
Either you are bullshitting or aren't paying attention to your work. Project ideas pop up naturally when building "endless amounts of ..". Make a framework for yourself, I don't know. Make something your colleagues could benefit from
>>
>>60581905
>String

0/10 apply yourself
>>
>>60581905
>importing status 200 specifically
Jesus christ who let this language out of its crib. Shit like this needs to suffer SIDS.
>>
>>60581732
I play a game with myself. If I reach a certain milestone in my program I award myself with a nice fap session. It's pretty effective
>>
>>60581764
>>60580555

Literally not even using
foreach
, collections/LINQ, or even a null coalesce.

This:
if (options.OutputFilename == null)
{
outputFilename = fileName;
}
else
{
outputFilename = options.OutputFilename;
outputFilename = outputFilename.Replace("<o>",
Path.GetFileNameWithoutExtension(path));
outputFilename = outputFilename.Replace("<e>",
Path.GetExtension(path));
}


Can be replaced with:
outputFilename = options.OutputFilename?.Replace("<o>").Replace("<e>") ?? fileName;


Those bars are in those strings because apparently the XML tags in the cod is breaking 4chan. wtf, moot.

im a cuck
>>
>>60581961
>
outputFilename = options.OutputFilename?.Replace("<o>").Replace("<e>") ?? fileName;

replace with
var ext = Path.GetExtension(path);
outputFilename = options.OutputFilename?.Replace("<o>", ext).Replace("<e>", ext) ?? fileName;
>>
>>60581961
>foreach

B L O A T
>>
>>60581936
Once I "rewarded myself" in bathroom at work when one of our teamleads barged in since I forgot to lock the door for some reason. What's interesting is that it happened again after a year or so; I was simultaneously shitting, farting and masturbating this time.

What does he think of me I wonder
>>
>>60581961
foreach is slower though
>>
>>60582017
It can actually be orders of magnitude faster than a traditional for loop in some cases.
>>
>>60581990
Since he didn't fire you, He must have liked what he saw.
>>
>>60581986
Is worrying about bloat in a high level language like C# a bit of a moot point?

I mean, unless you're optimizing an algorithm that is clearly far too performance intensive it's a bit silly.
>>
>>60581732
Cross dress and take hormones
Won't get any boners
>>
>>60581913
I know right! It's so concise!
>>60581932
There will be gradual improvements!
>>60581935
Here you go!
status200 = Status 200 []
>>
>>60580196
What is a ``FP" though??
>>
>>60581961
>foreach
I wanted to but at some point I had to use an index so I just rolled with regular for loops. At some point this changed again but I couldn't be fucked refactoring again.

>collections/LINQ
LINQ is real neat but I don't think I need to do any querying in my code.

>null coalesce
Completely forgot about those, fuck they are good.
>>
>>60582056
Still requires a definition for Status, or am I being retarded?
>>
hi guys, im learning c++ and i want to make a music player, with a focus on design, does anyone know how i can make the interface customizable with skins?? what framework can i use? i was thinking QT...
>>
>>60582154
yes use QT.

pretty sure QT would support plastering a .jpg image on their components, look in the QT documentation.
>>
>>60582154
Use SDL. I know SDL is designed to be used for games but I know it really nice to use for desktop applications.
>>
>>60582108
>fuck they are good
Anyone who thinks anything in that shitlang can be "good" is clearly fucking delusional.
>>
>>60582195
C# is by far my favorite language, I love the hell out of it.
>>
>>60582137
data Status
= Status { statusCode :: Int
, statusMessage :: B.ByteString
} deriving (Show, Typeable)
>>
>>60582201
Definitely not.
You shouldn't use C* for any purpose.
>>
>>60582201
>excitement
>optimism
>>
>>60582233
But I just did.
>>
>>60582243
and you should feel bad for being dummy
>>
>>60582233
why would you say so
c hash is a bretty comfy language
>>
>>60582243
I realize that being a poor programmer, you may lack the cognitive capacity to understand that.
>>
>>60582262
>comfy
I'm not surprised someone such as yourself would find C h*sh a "c*mfy" language.
>>
>>60582192
im tempted but sounds too much work, im going to look into it...
>>60582168
i've never seen a cool qt interface though, does it supports animations like menu slides and stuff??
>>
File: onii.png (121KB, 345x288px) Image search: [Google]
onii.png
121KB, 345x288px
>>60581822
>new IP
Masterful pasta, anon.
>>
>>60582297
Battle.net app uses QT just off the top of my head. Though I've heard it's a custom fork of it.
Probably a lot of other programs that you just don't realize too.
>>
>>60582264
Hey buddy I think you got the wrong general
>>>/g/wdg/ is two blocks down
>>
>>60582322
Fuck you
>>
>>60581990
In all likelihood he was coming in to do the same thing
>>
>>60582297
https://showroom.qt.io/
>>
>>60582322
>Hey buddy
I'm not your "buddy". Subhumans such as yourself aren't allowed to refer to me like that.
>w"""d"""g
I think your kind would be more familiar with that place.
>>
>>60582332
Fuck you leatherhead
>>
>>60582345
Lurk some time before trying so hard to fit in
>>
>>60582354
Then strip down and fight me, smartass
>>
>>60582364
Sorry, this is a thread about programming, not "soft"""dev""""
>>
>>60582386
Get out of that jabroni outfit
>>
>>60580630
>Imagine a /dpt/ without anime, autism and faggotry
wow that sounds boring
>>
>>60580241
That's a rude thing to say, anon
>>
File: 9vklLXJ.jpg (24KB, 400x386px) Image search: [Google]
9vklLXJ.jpg
24KB, 400x386px
>>60581257
>dumb frogposter
>he thinks frogposters are dumb
>>
>>60580831
accidentally implementing recursion?
>>
>9vklLXJ.jpg
>ribbit the ribbit frog
The redditors seem to be out in force at the moment. I don't want any reddit stink nearby. Piss off.
>>
>>60582402
[locker slamming intensifies]
>>
>>60581308
>I thought it was "Code Review" not "Ethics Review", but whatever.
It's hilarious that right wingers are always griping about this.
>"Muhhhhh!! Let me do this mean thing, it's my RIGHT! Dur a dur it's my GOD-GIVEN WHITE [I MEAN RIGHT] to be helped out with doing things people don't want me to do!!!"
Fuck off, if you want to make something happen that no one wants to see but you then you'll have to do it yourself without any help. How is that anything but fair?
>>
File: 0042 - 8oSFC3e.jpg (39KB, 420x420px) Image search: [Google]
0042 - 8oSFC3e.jpg
39KB, 420x420px
>>60582444
>>
>>60582474
>Muhhhhh
>Dur
>>>/v/
Piss off. Your kind simply isn't welcome here.
>>
File: software engineering.png (171KB, 800x600px) Image search: [Google]
software engineering.png
171KB, 800x600px
I've been programming for years - did a ton of Java in high school all the way through college (recent grad), and wrote some C programs for an operating systems class. I still don't feel like I'm a proficient """"programmer"""" though; I'm an EE major, so more physics and hardware-inclined. Thus I've only ever written programs for class projects, under deadlines.

Now that I'm gunning for jobs I'd like to shape my *general* coding skills moar, and basically just write stuff for fun. I have no idea what specifically to delve into, and a lifetime supply of adderall. Any quick suggestions?
>>
>>60582474
So do you believe NMAP should be banned?
>>
>>60582486
Like take this douchebag for example. It's his right to be a nuisance, and he's exercising it all by himself like a big boy. He's not childishly demanding to be heard, he's just speaking. Right wing retards, take note.
>>
You know, gatekeeper, you could try writing a bot for your thing. It requires programming skills though
>>
>Right wing retards
Leftist trash such as yourself should stick to your leftist board >>>/pol/
>>
>>60582497
Try writing programs people might actually want to use rather than toy projects or highly specialized stuff. Don't aim to do something new though, just do something that already exists.
>>
>>60582438
yeh..kinda ashamed about it
>>
>>60582497
>coding skills
Not programming related. We don't "code" here.
Try asking on >>>/g/wdg/
>>
>>60582529
But anon, /pol/ is a right wing cesspool.
>>
>>>/pol/ is left wing trash (precisely where you and your subhuman kind belongs).
>>
File: 1488068222177.jpg (47KB, 567x561px) Image search: [Google]
1488068222177.jpg
47KB, 567x561px
>>60582474
>>
>>60582572
No, it's right wing trash.
>>
I'm not surprised someone of your kind thinks something can somehow be two mutually exclusive things at the same time.
>>
>>60582037
This unironically
>>
I'm not surprised someone who thinks like you do would believe that your language is actually good when it is in fact bad.
>>
>>60582676
>>60582656
take your pills
>>
>>60580555
Isn't this against GitHub's CoC?
https://github.com/Booom3/Image-Comparer/issues
>>
I don't use ``languages", sorry.
>>
>>60582688
Lmao probably, I forget they're anal.
>>
>>60582707
sorry, but i have no choice than flag your account for misbehavior.
>>
I do believe that you should not use your programming language as it does not teach you enough about computers, instead learn my preferred programming language as it will make you smart.
>>
File: 1491613448251.jpg (51KB, 828x960px) Image search: [Google]
1491613448251.jpg
51KB, 828x960px
>>60582668
>>
File: wat.jpg (25KB, 125x125px) Image search: [Google]
wat.jpg
25KB, 125x125px
>>60582532
Alright, that's good advice. Because I'm inclined to want to do something cool and new right off the bat. [spoiler]although I can't really think of anything which I guess is part of my problem, so this solves it I suppose[/spoiler]

What kind of stuff do you have in mind that people would actually want to use? (that's suitable for someone as rusty in the practice as myself)

>>60582538
My bad, I forgot """coding""" is right up there with "cyberspace" in the actual programming community
>tfw a dirty hardware engineer
>tfw try to blend in with the codies, but fail anyway
>>
>>60582538
>We don't "code" here.
what is source code then?
>>
>>60582752
I don't know, never used it.
>>
>>60582743
I dunno, regular ass shit. Like a program that displays images, maybe displays a whole folder. Has some sort of sorting.

You know, super simple stuff like that.
>>
>>60582037
>>60582668
>>60582737
use std::mem::transmute as crossdress;

struct Boy;
struct Girl;

fn main() {
let trap: Girl = unsafe { crossdress(Boy) };
}
>>
File: 1451363404736.gif (742KB, 200x189px) Image search: [Google]
1451363404736.gif
742KB, 200x189px
>Your programs compile but they don't run as expected
>You're too new to debug them yourself
>>
>>60582778
Rust really is the gayest language
>>
File: yuuka_unamused.png (287KB, 568x310px) Image search: [Google]
yuuka_unamused.png
287KB, 568x310px
>>60582790
If you're this new you should use a babby IDE like Eclipse that debugs for you.
>>
>>60582656
>two mutually exclusive things
It's not, it's only one of them. It's exclusively right wing garbage. Bunch of dirty nationalists.
>>
File: 2017-05-25-143515_742x328_scrot.png (37KB, 742x328px) Image search: [Google]
2017-05-25-143515_742x328_scrot.png
37KB, 742x328px
Erlang is kill
>>
>>60582743
but anon cyberspace is an actual thing (but only in dealing with graphics, simulations, and games)
>>
>>60582852
It was never alive
>>
I think that fake confident pose and the embarassed face make a very attractive combination
>>
I genuinely believe that you of all people here would be silly enough to post a meme in my thread.
>>
>>60582852
What color theme?
>>
Especially bad thread today, everyone. Good job.
>>
>>60582907
We're not even halfway there yet.
>>
guys i want to make 2d animations and possibly a 2d game in C++, what library should i learn? im having a hard time choosing, i was looking into Qt, Opengl, SDL or SFML, but i dont know where to start, is it easier to learn SDL or is it better to learn OpenGL and skip SDL? anyone has pointers?
>>
>>60582902
Spacemacs Dark Theme
>>
>>60583033
SDL is for 2d, OpenGL is for 3d, games (e.g. sauerbratten) will use both, sdl for menus, opengl for gameplay. SDL is very easy to use and is well documented. The book SDL Game Development by Shaun Mitchell will guide you though making a sidescrolling platformer and applies to gamedev in general, it's what I used and it's very good investment
>>
>>60582688
Is this a GPL zealot bot?

that's awesome
>>
I know it depends on the program, but generally speaking, what all do you test when unit testing?
I typically start by testing that the program terminates "gently" and doesn't crash anywhere. Then i test lower and upper bounds, like the minimum value to expect, etc.
>>
>>60583098
>Is this a GPL zealot bot?
no, but i got my account flagged as a bot once

>>60582707
what do you plan to do about the issue?
>>
>>60583098
This! It's freaking epic.
>>
>>60580779
that's not how for loops work friend...
>>
>>60583233
Literally nothing. You've also commented on at least one of my other repositories a fucking year back or more.
>>
>>60582790
There should be a compiler flag to generate debug info with the executable. In gcc it's -g

If you use it, you can use a debug shell called gdb. Invoke with "gdb program_name". Once in the shell, use "run" to run your program until it crashes, "backtrace" to check out what it was doing when it crashed, and "quit" to exit the debug shell.

Another debugging tool is called valgrind. Invoke with "valgrind program_name"; it will show you any memory leaks or memory corruption and where they occur. This can be helpful to improve program performance, as well as to debug erroneous and/or unpredictable behavior even if it doesn't crash.
>>
>>60581822
> I have six IT certs and a comfy understanding of hardware and firmware

>BUT I DON'T KNOW C WAHHHH STOP SAYING TO USE IT

anybody with as much experience as you claim to have could use any language as needed even if they hadn't used it before.
>>
>>60583324
>Literally nothing.
then close the issue? but please adopt gplv3, don't be traitor to the revolution

>>60583324
>You've also commented on at least one of my other repositories a fucking year back or more.
i doubt that.
>>
>don't be traitor to the revolution
>>>/r/ibbit/
>>
>>60583423
GPL is a good license if you want nobody but other 5 freetards to use your shit
>>
File: ferris tea.png (502KB, 486x481px) Image search: [Google]
ferris tea.png
502KB, 486x481px
>>60582778
static void *(*crossdress)() = &malloc;

int main(void) {
Girl *trap = (Girl *) crossdress(sizeof(Boy));
}
>>
>>60583540
This doesn't even make sense, you define crossdress as a pointer to a function with no arguments and then call it with size_t. And you don't actually cross-dress anything.
>>
>>60582668
>>60583540
what's her name?
>>
>>60583578
you're allocating girl with a boy inside

also, C lets you make function pointers without argument checking, but not C++
>>
>>60583601
There's no Boy inside, you're allocating Boy-sized chunk of uninitialized memory, sizeof(uint32_t) == sizeof(float) in most configuration, but that doesn't mean uint32_t and float are the same thing.
>>
>>60583625
>There's no Boy inside
Of course. It's a girl.
>>
>>60583587
>her
>>
File: heh332.jpg (164KB, 984x962px) Image search: [Google]
heh332.jpg
164KB, 984x962px
What are the semantics of the sizeof operator?
The standard says there's 2 forms, except there's really only one and it's sizeof lvalue and sizeof (type), the parentheses aren't part of the operator, you're measuring the size of a typecast operator.

So when i do something like sizeof(arr) / sizeof(arr[0]), does this have a different behavior from sizeof arr / sizeof arr[0]?
>>
>>60583724
>focusing to the parentheses
The key difference here is lvalue/type, sizeof can actually be a run-time value, for VLA for example.
>>
Various people unironically pay me to make software, I'm ok at solving problems, I try learning new shit everyday. But for some fucking reason I always feel like I am scamming people, like I am a fraud or something, not a programmer and it's sad

What's wrong with me /g/

Maybe I should try contributing to open source projects, I imagine accepted pull requests could make me feel better
>>
>>60583955
>unironically
>>>/v/
>>
>>60583955
its called being modest and self-critical, things everyone needs but lack.
>>
>>60583955
>But for some fucking reason I always feel like I am scamming people, like I am a fraud or something

One of two reasons

A) You are a shit programmer who needs to read more

B) You are a decent programmer who needs to read more and get more confidence

AKA Read more
>>
Is it bad that js is my favorite language so far?
>>
>>60584027
>so far
how far
>>
>>60584027
>js
Not programming related.
Use >>>/g/wdg/
>>
>>60584027
yes and no, everyone likes their first language for the first few weeks. Youll move on quick
>>
>>60584027
Press ":q"
>>
>>60584092
>not :q!
>>
>>60584154
enjoy losing your progress
>>
>>60583540
>casting void* into Girl* EXPLICITLY
fucking sepplesfag.

>empty parenthesis syntax
Wait now I'm confused! What kind of mutant are you exactly?
>>
File: 1286055206613.jpg (41KB, 464x388px) Image search: [Google]
1286055206613.jpg
41KB, 464x388px
Java is shit.
Depending on the value it holds, I want my enum to perform a different operation on the data. But the methods can't see the data because they're static and the data is not. Is it even possible, are enums not intended for this?
enum Function {
MULTIPLY {
doIt() {
...
}
}
DIVIDE {
doIt() {
...
}
}
Double[] data;
}
>>
>>60584166
>saving any Jshit
>>
I want to write a useful application in C. I'm done with hello world stuff.
>>
>>60584027
When you get bitten by JS's shitty magic conversions you'll get a clue.
>>
>>60584171
Pre-ansi C actually required the explicit casting because there was no void * type and everything was an implicit integer unless stated otherwise.
>>
>>60583499
yeah, only 5 freetards use gcc
ony 5 freetards use gnome
only 5 freetards use coreutils
only 5 freetards use gnu plot
only 5 freetards use qt
only 5 freetards use blender
only 5 freetards use linux
only 5 freetards use git
only ...
>>
>>60584406
Now you're getting it
>>
>>60584220
>Pre-ansi C actually required the explicit casting
So? The code clearly isn't pre-ansi C.
>>
>>60584619
>code
Please...
>>
dead thread
>>
i have no motivation someone please be my learning buddy ;_;
>>
I'm working through a C book and this is the code I've produced to answer one of the excercise problems in pointer arithmetic:
bool search(const int a[], int n, int key){
int *p = a;
while(p < a + n){
if (*p == key) {
return 1;
}
p++;
}
return 0;
}

It works fine but upon compiling using gcc i recieve this error:

In function 'search':
8:11: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]

But, as I said, the function and program run fine otherwise. I'm not altering the values within the array so why does it complain about my copying the array pointer into another pointer? Is there a way to fix this without removing the 'const' keyword because the text suggests I use it. Thanks.
>>
>>60584849
what are you learning?
>>
File: 1491105560128.jpg (53KB, 640x426px) Image search: [Google]
1491105560128.jpg
53KB, 640x426px
>>60584849
Sure thing, anon-san. Just step into my office over here and we'll motivate you real quick like. Did I mention we have some Pink Floyd, Bon Jovi, and Yes in addition to free beer?
>>
>>60584869
You should call the pointer as const int *p
If you write int *p = a you can use p to modify the vector a, that's why the compiler gives you error
>>
>>60584869
int *p = a;

needs to be
const int *p = a;
>>
>>60584220
I'm pretty sure pre-ANSI C malloc returned a char* not int
>>
File: 1488201548448.jpg (498KB, 1200x1600px) Image search: [Google]
1488201548448.jpg
498KB, 1200x1600px
https://www.youtube.com/watch?v=n2xH9vSmWg0

Just made one of those nonstop music streams
Itll sometimes play some spanish ads but that can be fixed with spotify premium, im just broke
>>
File: old_hag_langs.png (173KB, 600x355px) Image search: [Google]
old_hag_langs.png
173KB, 600x355px
>>60584027
Yes.
>>
>>60584916
>>60584917
That makes complete sense. I don't remember reading that bit. I'll skim the chapter again to make sure I didn't overlook that bit.
Thanks guys.
>>
>>60584937
not enough qt girls on loop
>>
>>60580219
Shit taste in animu girls AND programming philosophy. You are not living your life correctly.
>>
>>60584962
She has noided eyes
>>
>>60584923
You are correct. That anon is beyond retarded.
>>
char name[MAX];

is the same as
char *name;
name = malloc(MAX*sizeof(char));

When I change in my program to the 1st version and remove all char mallocs my program stops working.
Aren't the 2 versions supposed to be identical?
>>
>>60585063
>sizeof(char)
OUT
>>
>>60585063
they have similar semantics, but a stack allocated array has a different type from a pointer to a heap allocated block of memory.

But for most purposes, both will decay to pointer to char when passing them around.
>>
>>60585063
>MAX*sizeof(char)

malloc( sizeof(char[MAX]) )
>>
Why don't more programs come with a configure script? Is the configure script optional or do the developers run the script and have the make file with the tarball?
>>
>>60585102
that's the point dummy
>>
>>60585176
because each project has their own way of sacraficing something sacred and summoning demons insined your pc to build your project.
If you look at the Makefile(assuming the project even uses Makefile) it might actually just call some bash script that does all.
>>
>>60585063
the first one "frees" the memory as soon as the function it's in returns, the second one has to be freed manually
>>
Only C, assembly and logic gates are holy
The rest is just a pest
>>
 #define     AI_FALSE   0
#define AI_TRUE 1

I think that the guy who programmed this project should be killed.
0 is false and if you want your faggy bool types you can just import <stdbool.h>.
>>
What's a good GUI module to use for Python? easygui is easy as shit to use but it's also ugly as sin and I don't know what the best alternatives are.
>>
>>60580189
>>60580209
You mean splay tree.
>>
>>60585327
Use electron and js you FOOL.
You literally cannot make GUI's with c/c++ based libraries.
>>
>>60585343
Cancer
>>
I have some ideas, but which should I work on?
A file tracker with some language semantics built in
Or a small language to organize recipes and when compiled produces natural language.

I know more about how I would actually implement the file tracker because I've been I've been heading my files in this format even though i don't have anything for it yet.
>>
>>60585309
in the windows API, it's

0 is for FALSE
1 is for TRUE
rest is for UNDEFINED

reminder that if( foo ) and if (foo == true) are not the same thing
>>
can someone tell me why this is overestimating by 10 across the board?

import pandas as pd
import numpy as np
import quandl, math, datetime
from sklearn import preprocessing, svm
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
import matplotlib.pyplot as plt
from matplotlib import style
style.use('ggplot')

df = quandl.get("WIKI/GOOGL")
df = df[['Adj. Open', 'Adj. Close', 'Adj. High', 'Adj. Low', 'Adj. Volume']]
df['Volatility'] = ((df['Adj. High'] - df['Adj. Low']) / df['Adj. Low']) * 100
df['Change'] = ((df['Adj. Close'] - df['Adj. Open']) / df['Adj. Open']) * 100
df = df[['Adj. Close', 'Volatility', 'Change', 'Adj. Volume']]

forecast_col = 'Adj. Close'
df.fillna(-99999, inplace = True)

forecast_out = int(math.ceil(len(df) * .01)) # about 30 days
# forecast_out = 1

df['label'] = df[forecast_col].shift(-forecast_out)
df.dropna(inplace = True)

X = np.array(df.drop(['label'], 1))
X = preprocessing.scale(X)
X_recent = X[-forecast_out:] # the observations that are too recent to have forecast values
X = X[:-forecast_out] # the rest
y = np.array(df['label'])
y = y[:-forecast_out]

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = .2)

classifier = LinearRegression()
#classifier = svm.SVR() # this does a lot worse, in the 70's for r squared

classifier.fit(X_train, y_train)
rsq = classifier.score(X_test, y_test)
print("Test RSQ: ", rsq)
print("Prediction distance (days): ", forecast_out)

predictions = classifier.predict(X_recent)
print(predictions)
df['Forecast'] = np.nan
df.iloc[-forecast_out:,5] = predictions

df['Adj. Close'].plot()
df['Forecast'].plot()
plt.legend(loc = 4)

plt.title("Google Stock Predictions")
plt.xlabel("Date")
plt.ylabel("Adjusted Closing Price")
plt.show()
>>
>>60584937
The last time i tried Spotify again recently you could block ads altogether by using the hosts file

Too bad the music catalog is still shit and 90% of the songs i search for don't exist, i miss Grooveshark
>>
>>60585425
>8 lines of imports for a ~40 line script
>>
>>60585453
which library should i remake, pandas, numpy, quandl, sklearn, or matplotlib?
>>
>>60580372
Only annoying thing with #if 0 is not all editors will show it as a block comment with syntax highlighting.

Or they do, but they DON'T do the same thing for #if 1 #else type things, so you always have to have the negative part first.
>>
>>60585063
No.
char *name
and
char name[]
are semantically identical.
char name[x]
is NOT the same, since it's not only defining a pointer, but also defining space in the current scope for that pointer to point to.
>>
>>60585509
They're not supposed to, it's not a comment.
You're deleting code at the preprocessor stage while moving stuff around.
>>
>>60580376
Gcc isn't lalr 1
>>
>>60585425
you shouldnt expect a linear regression model to properly predict stock prices, right?
>>
I hate to be a pest but I can't understand why this function won't work. I've left in the test prints to see what was wrong and the function continually adds 0*0 when I compile it. Array's a and b are assumed to be of equal length n.

double inner_product(const double *a, const double *b, int n){
const double *foo, *bar;
double sum = 0;
for (foo = a, bar = b; foo < a + n; foo++, bar++)
{
printf("%d * %d = ",*foo, *bar);
sum += (*foo) * (*bar);
printf("%d\n", sum);
}
return sum;
}


Thank you.
>>
>>60585572
Don't make food and bar pointers
>>
>>60585565
run it, the prediction almost exactly follows the actual but 10 units above. it should look like here at 10 minutes in
https://pythonprogramming.net/forecasting-predicting-machine-learning-tutorial/

the changes i made used non-deprecated libraries and should do the same thing
>>
>>60585523
>
char name[x]
is NOT the same, since it's not only defining a pointer, but also defining space in the current scope for that pointer to point to.
Yes it is, and no it doesn't
>>
>>60580376
Yeah, it's actually 100% retarded legacy shit. No one bothered to implement it back in the day, so it never entered the standard.

the real question is, why isn't it supported nowadays in C (the answer is probably that someone somewhere put a bunch of random lines with /* in their comments, and enabling nested multiline comments would immediately break that code)?
>>
>>60582071
A fashion statement
>>
>>60585529
The preprocessor removes the comments though.

If you had the option of making #if 0 blocks appear the same as /* */ why the hell wouldn't you use it?
>>
>there is a proposal by Herb Sutter to add 2d graphics based on cairo to c++ stl
wew lads
>>
>>60585662
>not 3D
dropped
>>
>>60585661
Because no other #define or preprocessor directive block exhibits this behavior.
You're coopting the preprocessor for your convenience, it's not a comment block.

Also, what if you did something like #if __cplusplus to nullify blocks of code?
Those are now comment blocks according to you.
>>
>>60585572
%d is not %f

int main() {

int n = 10;


double * a = (double *) malloc(sizeof(double)*n);
double * b = (double *) malloc(sizeof(double)*n);

for (int i=0;i < n;i++) {
a[i] = i;
b[i] = i+2;
}

inner_product(a,b,n);
return 0;
}


0.000000 * 2.000000 = 0.000000
1.000000 * 3.000000 = 3.000000
2.000000 * 4.000000 = 11.000000
3.000000 * 5.000000 = 26.000000
4.000000 * 6.000000 = 50.000000
5.000000 * 7.000000 = 85.000000
6.000000 * 8.000000 = 133.000000
7.000000 * 9.000000 = 196.000000
8.000000 * 10.000000 = 276.000000
9.000000 * 11.000000 = 375.000000
>>
>>60585572
>>60585698

such mistakes can be avoided by
gcc -Wall


also forgot to free()
>>
>>60580376
>>60585645
I'm pretty sure the reason is that they don't want to have multiple ways to do the same thing;
#if 0
...
#endif

already works.
>>
>>60585720
No it's because gcc is not lalr1 and they just had to make it up
It probably never crossed their minds
>>
>>60585622
Wrong.
char x[10]; x[4] = 'C';
will work just fine.

char x[]; x[4] = 'C';
will most likely segfault.

The difference is that the latter doesn't have any allocated memory.

>>60585662
Sure you don't mean stdlib rather than stl? STL is for data structures lol. And I don't see what would be wrong with putting graphics in stdlib, as long as they're cross-platform. C++ stdlib is already bloated, and lack of built-in graphics support is a notable deficiency. Though it would conflict with the 1970s mentality that your sole interaction with the outside world is through a teletype.
>>
>>60585697
Because #if 0 is used so often purely as a comment block.

This isn't a new idea m8, editors have been doing it for a long time, it's just not standard behaviour.
Like I said, why would you NOT want the contents of a #if 0 block to have comment style?
>>
How do you make an operating system? Where do you even start with something like that?
>>
>>60585697
Except that WOULDN'T nullify in a C++ compiler. So it's idiotic.
>>
>>60585828
http://wiki.osdev.org/Tutorials
>>
>>60585698
>>60585714
So it's been working fine I just haven't been using the right string formatting. Look's like I got a bit flustered and forgot I was summing the products when I put in my test prints. Whoops.
Thank you a bunch, though. I'll need to pay closer attention to the little details like that. Would you have a suggest on cleaning up my for loop, though? It seems convoluted. How could I rewrite this using a while loop?
>>
>>60585812
http://www.open-std.org/jtc1/sc22/wg14/www/C99RationaleV5.10.pdf
>6.4.9 Comments
>The C89 Committee considered proposals to allow comments to nest. The main argument for
>nesting comments is that it would allow programmers to “comment out” code. The C89
>Committee rejected this proposal on the grounds that comments should be used for adding
>documentation to a program, and that preferable mechanisms already exist for source code
>exclusion. For example,
>
#if 0
/* code to be excluded */
#endif

>Preprocessing directives such as this prevent the enclosed code from being scanned by later
>translation phases. Bracketed material can include comments and other nested regions of
>bracketed code.

>Another way of accomplishing these goals is with an if statement:
>
if (0) {
/* code to be excluded */
}

>Many modern compilers will generate no code for this if statement.
>>
>>60580779
>redeclaring VAR type
WHATEVER SHIT LANGUAGE YOU ARE USING-FAG GET OUT GET OUT GET OUT AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
>>
File: googe.png (59KB, 812x612px) Image search: [Google]
googe.png
59KB, 812x612px
>>60585425
>>
>>60585867
>if (0)
>needing valid code in comments
what a fucking joke
>>
>>60585841
like mentioned
gcc -Wall
helps a lot

you have a bit overhead in your program, foo and bar suck a bit tbqh.
why not this loop:

    for (int i=0;i < n; i++) {
printf("%f * %f = ",a[i], b[i]);
sum += a[i] * b[i];
printf("%f\n", sum);
}


increases readability and you dont have to declare two extra pointers
>>
>>60585911
That's why you should use the preprocessor form. While it's "supposed" to be syntactically valid code, I don't believe any actual compiler gives a shit about it.
>>
>>60583540
#define crossdress(size) malloc(size)
/* you are a faggot */
>>
>>60580667
That was ALGOL quality!

>>60580779
Lolno, because the first statement is only run once, when the loop is first entered. But C++ allows this idiocy:

for(int i = 0; i < 10; ++i) {
int x = g_somearray[i];
somefunction(x);
}

Even though by all logic, it would imply either crerating/destroying a stack frame every pass through the loop, or redefining the same variable.
>>
>>60585942
function pointers are more fun, also this keeps trap faggotry contained to a single compilation unit
>>
>>60585923
Sorry, I should clarify that I'm doing exercising from a C book and I'm in the section utilizing pointer arithmetic. I was explicitly instructed not to use array subscripting. Otherwise I most certainly would have because it is much cleaner looking
Disregard the printf statements, they were an attempt to see why my loop wasn't working.
>>
>>60585962
function pointers are also dumb to work with gayboy
>>
>>60580779
kek
tell me wrote this post with clear purpose to trigger /dpt/ to the tits
>>
>>60585269
>>60585523
What if it's a structure like
struct dude {
char name[MAX];
char profession[MAX];
}
Then I do
struct dude *my_dude;
my_dude = malloc(sizeof(struct dude));

Does it also allocate memory for the two chars?
>>
>>60580178
>trap shit
Homo.
>>
>>60586028
Yep
>>
>>60585987
every for loop can bew rewritten in a while loop and vice versa.

for (initialization ; condition ; increment)

initialization
while (condition)
increment
end while

    foo = a;
bar = b;
while ( foo < a + n)
{
//printf("%f * %f = ",*foo, *bar);
sum += (*foo) * (*bar);
printf("%f\n", sum);
foo++;
bar++;
}
>>
>>60585437
>Too bad the music catalog is still shit and 90% of the songs i search for don't exist,
maybe try listening to non-autistic genres
>>
>>60586125
no fun in that though
>>
>>60586125
if spotify can't stream protracker modules from the internet and play them in real-time, it's shit
>>
File: 1493102557564.gif (40KB, 220x220px) Image search: [Google]
1493102557564.gif
40KB, 220x220px
Someone explain this magic...

hash = ((num << 8) | num) % 64;
>>
>>60586169
shift the bit representation of num 8 spaces to the left, then include only the bits that appear in both the new integer and num, and then divide by 64, taking only the remainder.
>>
>>60586197
I meant
*bits that appear in either num << 8 and num
>>
In C, can I use if statements to make a function check something, and then do a bunch of other if statements inside of it. Just as an example, say I check if a number is even, and if so, check if it's greater than 10, then add 5. Or else, if it's odd, check if it's greater than 15, then subtract 5.
>>
>>60582778
How does this compile? Crossdress() is defined as transmute(), which copies bits from an object of one type to an object of a different type. However, Boy is defined as a type (or formally, a ``struct tag"), not an object.

Also, presumably the actual definitions of Boy and Girl are in some other file, but how can the compiler generate proper code without having the definitions? You'd either need to provide a size argument (which isn't explicitly provided, and the compiler can't reasonably generate one without having access to the file containing the definitions of the struct, or using RTTI (which is NOT a ``zero-cost abstraction").

>>60583540
Casting the return value of malloc() (or in this case, crossdress()) is unneccessary except in C++ or K&R. Void pointers don't exist in K&R, and in C++ () means "no arguments", which isn't consistent with other elements of your code.

>>60583601
No, there's no "Boy inside", because the essence of "Boy", in a C context, would come from the layout of the "Boy" struct. Since the layout of the struct is never used, there never really is a "Boy" in the first place. You should rather instantiate a Boy struct, and assign it to a Girl struct, which is basically what the Rust example.

Additionally, I'd say pointer casting is a better way of implementing crossdressing, since crossdressing doesn't actually make you a girl, it just lets you function as one temporarily. In which case the proper implementation of crossdress would be something like:

/*
* We use pointers here since we're passing by
* reference, we don't want to actually create
* any new boys or girls
*/
Girl *crossdress(Boy *aBoy)
{
return (Girl *)aBoy;
}
>>
>>60586089
Right, I understand. I meant more specifically with the condition. Our arrays are assumed to be of equal length but is there a more general way to iterate through them both without using one over the other in the condition while still using pointers rather than subscripting.

Using subscription I would write something like this:

while(n){
sum += a[n-1] * b[n-1]
}


Otherwise, using pointers the closest thing I can come up with is:

foo = a;
bar = b;
while(n){
sum += (*foo) * (*bar)
}


These should be equivalent but something about them feels wrong. I guess I should just run them.
>>
https://quiz.triplebyte.com/
>>
File: hash.png (6KB, 624x228px) Image search: [Google]
hash.png
6KB, 624x228px
>>60586169
>>
>>60586222
Sorry! Inside should have been:

sum += (*foo++) * (*bar++)
>>
>>60586215

if (devil is 6) {
if(guitar riff) {
printf("then god is 7\n");
}
}
>>
>>60586215
To explain better:
    if(x%2 == 0){
if(x>10)
{
x += 5;
}
}
else{
if(x>15)
{
x -= 5;
}
}
>>
>>60586252
VALID C CODE
>>
>>60586222
definitely, just run them!

    foo = a;
bar = b;
while ( n--)
{
sum += (*foo++) * (*bar++);
printf("%f\n", sum);
}


the power of incrementation
>>
>>60586222
>>60586248
And obviously an: n-- inside both loops.
I need to slow down my typing.
>>
>>60586252
>>60586273
C doesn't have pattern matching?
>>
>>60586299
No. C is truly a language for brainlets
>>
File: vomit.jpg (90KB, 650x650px) Image search: [Google]
vomit.jpg
90KB, 650x650px
>>60586273
>That indent style
>>
>>60586293
Thanks a ton, anon. It helps to think things "out loud" to someone. Have a good one.
>>
>>60586228
Question 3 is basically a demo for how shitty python can be.

For people who won't do the quiz:
An array is passed into a function, this function then appends "foo" to it, and then sets it's value to "bar", "baz" using the assignment operator.
But wait! Since the array is passed "by assignment"(by reference when we feel like it), the value isn't actually changed, and elems becomes a local variable with the same name as the argument! What.
>>
File: fey.jpg (4KB, 128x128px) Image search: [Google]
fey.jpg
4KB, 128x128px
>>60586357
thanks, you too!
learned that stuff ages ago, never used it
>>
>>60586247
>>60586197
>>60586210
I ran that portion of code and the output came out as:
num: 1
hash bucket: 1

num: 2
hash bucket: 2

num: 3
hash bucket: 3

num: 4
hash bucket: 4

.
.
.

num: 50
hash bucket: 50

num: 51
hash bucket: 51

num: 52
hash bucket: 52

num: 53
hash bucket: 53

num: 54
hash bucket: 54

num: 55
hash bucket: 55

num: 56
hash bucket: 56

num: 57
hash bucket: 57

num: 58
hash bucket: 58

num: 59
hash bucket: 59

num: 60
hash bucket: 60

num: 61
hash bucket: 61

num: 62
hash bucket: 62

num: 63
hash bucket: 63

num: 64
hash bucket: 0

num: 65
hash bucket: 1

num: 66
hash bucket: 2

num: 67
hash bucket: 3

num: 68
hash bucket: 4

num: 69
hash bucket: 5

num: 70
hash bucket: 6
I'm curious as to how its not colliding with other buckets... (in reguards to the % 64)
>>
>>60586387
Not sure how I fucked that up, but:

I'm curious as to how its not colliding with other buckets... (in regards to the % 64)
>>
>>60586387
Try bigger numbers.
>>
>>60586360
WEW, question 4 is almost the same.
It creates a 2x2 matrix by appending a variable named row containing [0,0] to an array, and then sets the value of [1][1] to 1, but since python appends by _fucking_ reference, [0][1] is also set to 1.
Holy shit.
>>
>>60586356
it's so much worse than you realize. I didn't want to post the actual code because I'd get brutalized but fuck it, here goes:
void encode(int i, string s){
int length = strglen(s);
for(int j = 0;j<length;j++){
if(caseCheck(s[j] == 0)){
s[j] += i;

if(s[j]>'z')
{
s[j] -= 26;
}
}
else if(caseCheck(s[j]) == 1){
if(s[j] != ' ')
{
s[j] += i;
}
if(s[j]>'Z')
{
s[j] -= 26;
}
}
}
printf("%s\n",s);
}



The case_check function returns 0 if a letter is lower case and 1 if it's not. I want it to increment every letter in the given string by i, but i also want it to wrap around. If I enter 'z', it comes out as 'a', but when I enter 'Z' it gives me [

be gentle please
>>
>>60586247

Hrm... since the bitshifted version has its 8 least significant bits all 0, thus defining the least 8 least significant bits of the OR'd version to be the 8 least significant bits of the unshifted version... and since the mod 64 operation just takes the 6 least significant bits of the OR'd version... couldn't the OR and bitshift operations be ignored entirely?
>>
>>60586407
Why was it made that way I wonder
To prevent expensive copying as much as possible?
>>
>>60586387
anti-collision techniques:
+ chaining
+ linear probing
+ quadratic probing
+ double hashing
>>
>>60586412
God damn, anon. Pick a style, and use it consistently. It's not hard.
>strglen
>caseCheck
Are you purposely avoiding using some standard library functions or something? These are duplicates of strlen and islower.
>string
Please don't do typedefs like this. They cause more trouble than they're worth.
>if(s[j] != ' ')
I don't know what this is trying to achieve.

Is this function supposed to be a Caesar cipher or something?
>>
>>60586444
I understand copying is expensive, but this is implicit, and it kind of pisses my off.
>>
>>60586518
me*, it also bugs me that this is supposed to be a general programming quiz, but expects you to have knowledge of Python's argument passing methods.
>>
>>60586494
>Is this function supposed to be a Caesar cipher or something?
yes
>>
>>60586597
You should have it ignore all non-alphabetic characters.
>if(caseCheck(s[j] == 0)){
You have the equality INSIDE the arguments here.
>but when I enter 'Z' it gives me [
I don't get that.
>>
New thread:
>>60586810
>>60586810
>>60586810
>>
>>60582297
Use SDL with Nuklear for GUI functionality.
>>
>>60585343
splay trees are one of those ideas that seems really clever and cool
but coding it kind of sucks
and you realize it kind of sucks in the real world because every read turns into a bunch of writes
:/
>>
>>60581376
you'll learn to think of languages as tools you can shape yourself, rather than being handed down from the gods
Thread posts: 319
Thread images: 35


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