#“C pointers and memory management”
Explore tagged Tumblr posts
sunbeaminfo · 3 months ago
Text
Learn Advanced Pointers in C In Sunbeam Institute
Are you ready to take your C programming skills to the next level? Join Sunbeam Institute’s highly anticipated webinar on Advanced Pointers in C and become a master in one of the most crucial aspects of C programming. Pointers in C are more than just a feature; they are a powerful tool that allows you to directly manipulate memory, optimize code performance, and handle complex data structures with ease.
In this Advanced Pointer in C webinar, our expert instructors will dive deep into the concepts that are often challenging to grasp. You’ll learn:
How to effectively manage memory and avoid common pitfalls.
Techniques for handling arrays, strings, and dynamic memory allocation with pointers.
Understanding of pointer arithmetic and how to use it to manipulate data efficiently.
Tips for using pointers with functions and multi-dimensional arrays.
Best practices for debugging pointer-related issues in your code.
This webinar is perfect for experienced C programmers who want to refine their skills and apply advanced techniques to their projects. Whether you’re working on embedded systems, software development, or high-performance applications, mastering pointers will give you an edge in the competitive programming world.
Don’t miss this opportunity to learn from the best! Register now for Sunbeam Institute’s Advanced Pointer in C webinar and become an expert in one of the most powerful features of the C language.
Seats are limited, so secure your spot today!
0 notes
mustlearn · 2 years ago
Text
What is C++ programming language?
What is C++ programming language?
C++ is a general-purpose programming language created by Bjarne Stroustrup in 1983. It is an extension of the C programming language, and is often used for developing large and complex software applications, such as operating systems, video games, and simulations. C++ is a compiled language, which means that the code written in C++ is translated into machine code that can be directly executed by…
Tumblr media
View On WordPress
0 notes
rust-official · 1 month ago
Note
Why should I, a web developer who uses mostly Python and JS, learn Rust?
Aside from cargo-mommy, obviously.
(Seriously though I have been meaning to learn a lower-level language but what's the benefit of rust over like, C++?)
There's a lot to unpack in this question! For web development, you can get a LOT of performance and maintainability ouf of Rust compared to Python/JS. Particularly if your backends are CPU-bound there's so much to gain. But beyond that, the type safety of the language in addition to the static analysis of the compiler and clippy linting provide a fantastic foundation for maintainable, quality code that I've not seen in any other language in my 25 years as a programmer. When I was still hacking C regularly, I would turn on ALL the compiler warnings, use multiple free and commercial static analysis tools, valgrind, etc., all to do what you get out of the box with rust (and even those tools don't do for C/C++ what the rust tools do for Rust). It's hard to explain just how helpful these tools are if you're not familiar with them; it's a lot more than just "this variable isn't used", it's "you can write the code more elegantly / with better performance using this construction oh and if you're using an LSP I'll *make the change for you* at the press of a button" and there are dozens of lints like that. Seriously, the tooling for Rust is absolutely second to none. The tooling for Rust is better than the claims MS makes about Visual Studio. Specific to the language itself, Rust is so much more expressive compared to Python or JS. Particularly compared to Python's utterly anemic functional programming support, Rust shines as an example of what a language should be capable of. This thoroughly considered design permeats the language and the standard library, and many popular third-party crates have similarly excellent design. You can get *some* of these features with mypy, pylint, and so on, but the quality and quantity of diagnostics and suggestions provided by the stock Rust tools is just so superior. The tooling Rust provides has ruined other languages for me.
Specifically for the web development domain, there are some pretty lovely crates for that on the backend! I don't know the specifics, particularly how they compare to e.g. django or flask or the like, but I do know they're well-respected in the community. You can also compile rust to webasm and deploy that on your frontend to realize all the above benefits of Rust and also the performance of webasm, all while using a much higher level language than webasm itself.
Why Rust over C++? See above, the tooling is incredible. cargo is so far ahead of tools like conan and cmake that you can't even sensibly compare them. Rust comes with built-in package management, dependency management, project management, build tooling, a test framework, and so much more. Besides this, there's the obligatory, consuetudinary at this point, "no memory errors in Rust" thing. You're not going to have to worry about derefrencing a NULL pointer in Rust (... under most circumstances; as a low level compiled language you can still access memory directly, so it's possible, but not in >99% of code you write). There's just entire classes of footguns that are impossible in Rust. Yes, C++ is implementing some of these features, like Optional<T>, but that's the thing--*starting* to. These features have been core to Rust since the beginning. The community for Rust, at least in my experience, is the most welcoming tech community I've ever been a part of. There's a meme that it's full of trans folks and it's not just a meme, it's true. The stereotype of the trans girl Rust hacker exists for a reason.
I should point out that a lot of folks say rust compiles are slow but that's just not been my experience. I've been building things from source for 25 years and rust is just as fast as C++ if not faster (and if you're using clang, it uses all the same underlying LLVM libraries after parsing to LLVM IL so there's not much difference at that point).
I think that about covers the most important stuff, please feel free to submit further questions if you want more details :3
20 notes · View notes
cauchesque · 8 months ago
Text
using bare pointers is honestly an entirely different programming paradigm, as different from memory-managed imperative as functional is. unfortunately writing "good" "safe" c code without "heartbleed-tier vulnerabilities" means forsaking this
33 notes · View notes
soul-controller · 1 year ago
Text
Working His Body(Suit) III (Teaser)
In the midst of a lewd act, Martin is caught by his hunky new manager Tony at S-C Fitness. Upon encouraging him to finish, Tony then takes a moment to help Martin get acquainted with his new physique and learn about his job responsibilities while wearing the suit. Through doing this, Martin discovers two interesting secrets that make him even more intrigued about his new job...
Throughout their entire conversation, Martin was confused by the fact that Tony kept referring to his form as his “new identity” rather than his “new body”. As a result, his inquisitive mind was unable to stop itself from asking more questions. “What do you mean by new identity though? Like they just give you a new bodysuit and that’s it right? It’s not like you become somebody else entirely…”
To Martin’s horror though, Tony shook his head to deny that idea. “Nah, it’s an entirely new identity bro. New body, new name, new everything. They do some witness protection level shit to give you an entirely new identity so no one could possibly know who you used to be. Hell, I heard they even have the ability to make sure that you forget about who you used to be to make sure that the company’s secrets never become unveiled.” 
After reaching deeper into the box that had once contained Martin’s bodysuit, the man then pulled out a shiny new name tag. “Ah see, when you’re working here, you don’t even go by your real name anymore. Like, my name isn’t even Tony! From now on, it seems your work name is gonna be Emmanuel,” the manager revealed, grabbing onto the name tag and holding out for Martin to see.
Upon doing so, there was a bizarre sense of both panic and excitement about this reveal. Although he was quite happy with his name and family and thus didn’t want to lose that aspect of himself, the concept of turning into this hunky bodybuilder seemed like a dream come true. Hell, even his new name sounded hot to him and fit his new body much better than Martin!
“Ok, before we have you get out there and start working,” Tony began, ”we should run through some basics so you’re not completely thrown to the wolves out there.” This caused the nervous new employee to eagerly nod his head in agreement. Upon doing so, Martin listened as Tony gave tons of pointers about how to appropriately help their members do their best possible workouts like reminding him to have them lift with their legs rather than their backs.
Upon finishing up after rattling off a few more tips, Tony then ended his lesson by pulling off his shirt and revealing his ripped physique. Martin unintentionally gasped at the reveal, which caused Tony to chuckle and give a friendly wink in his direction before continuing to speak. “Alright, so we also have a bunch of bodybuilders that love to come in here and get help perfecting their poses before their shows. This is most likely going to be a popular task for you, especially given how incredibly large you are,” Tony explained, looking the man up for a moment and slyly licking his lips. Grabbing a hold of Martin’s callused hand, Tony led the duo to a large full-body mirror so they could both stare at their muscular physiques.
Out of nowhere though, Tony began to rattle off countless poses and tell Martin to do them. Although his mind had no idea what he was talking about, it seemed as though the bodysuit had some sort of muscle memory as it began to immediately move on its own accord and make Martin to do the desired poses. This initially freaked out the young man, causing him to frantically ask what’s going on until Tony explained that it’s all natural. Upon asking what he was talking about, Martin learned from his manager that the suits were embedded with a breadth of fitness knowledge that would allow any employee to effortlessly assist any gym member without having to stutter and be unsure of an answer.
“While working here, Tony explained, “there’s nothing you need to worry about. Just sit back and enjoy every perk of that incredible body of yours.”
Tumblr media
To read more about Martin and his experience with the bodysuit, click here to join my Patreon!
133 notes · View notes
dreamsofminnie · 1 year ago
Text
[Luke Pearce x Reader] Series
Tumblr media Tumblr media
Ch. 5-10 [Luke]
Previous | Masterlist | Next
—His Escape | Word Count: 2,590
Tumblr media
—March 16th, 12:23 AM
[[Recent message: I can’t help but peek into your room to see if you came back secretly.]]
Unbeknownst, the 100th sigh has now erupted from your lips as you fiddled with your lunch half eaten.
Peanut perched beside your plate occasionally pecking the dried figs you set for him.
“Peanut, you must miss your dad right? I miss Luke very much too.” Your pointer finger strokes the birb somberly as he peeps quietly.
“How many days has it been since he was gone? hmn, 4 days.” Laying your arms and head across the marble countertop your phone opened up to Luke’s one sided conversation.
Groaning you release your phone and bury your head between your outstretched arms.
“What to dooo, Fridays were our game and movie nights… ughhh! Luke you jerk! Maing me wait for you to come back like some military wife!! Give you a good scolding when you get back!”
Straightening your body and your resolve, you reach your finger out for Peanut to perch on and head upstairs.
“Apologizes Lukey, but I’m rummaging through your stuff.” Throwing his door open you find his usual messy desks and bookshelves that line the wall. His bed look haggard like he has been living here, in which, he really hasn't.
“Haizz, as always. Super messy Luke” Your sigh was so fond, one might’ve mistaken you as a wife whose waiting for their husband on an abroad trip across the world.
—March 16, 12:27 AM
[[Sent: Do you mind if i clean up a bit]]
[[Sent: I wont touch your important papers]]
Stuffing your phone in the back pocket, you roll up your sleeves to get to work. “Luke admires Sherlock Holmes to such an extent that he even matches Sherlock’s messy workplace.” Despite the grin on your face, the heavy document lifting will be a huge workout.
“If only you had arms to help me Peanut.” He tilted his head at your call while staying out of your way on the far window sill, his favorite sunbathing spot.
Piles upon piles were stacked against a corner you cleaned beforehand. Moved out of the path so access to other areas was easily accessible. Many of the papers were covered, with a label tag—simple to comprehend for the correct file in any case.
They stood tall so thickly that they rivaled your throat width solely in how many pages they contained.
How Luke actually managed to write up and read that is beyond you. The real hassle in detective work is the paperwork that research brings.
Even just a smidge, do you understand all of Luke’s sleepless nights you have caught him with his room light still shining bright. You had scolded him once while he apologized profusely. You were pretty sure he still managed to find a loophole and kept up with his late-night work hours. And you couldn’t say anything then, since you were studying up till sunrise.
One unfortunate chance was when Luke and you thought of sneaking into the kitchen for a quick snack and perhaps some caffeinated tea. Catching each other on tip-toes in pajamas, you making tea, and Luke getting snacks, was a fun core memory. Both of you ended up sitting in the living room working side-by-side. Till one of you would fall asleep on the other then eventually night passes then you and Luke wake up snuggled close.
Warmth had spread to you from cherished memories of a family you held dear. Wherever Luke may be, you just hoped he comes back in one piece, breathing and smiling bright.
Papers all stacked and on the side,you get to sweeping some of the discarded trash. Crumpled papers that— if unraveled, were rushed thought processes of a detective onto an exciting new lead.
His favorite juice boxes littered around his small trash can, as if his aim was terrible and he missed the trash with every new juice box.
Leftover craft materials were present only beside his bedside, which seemed like wood shavings, a dull carving knife, and cut-out paper. It seems you needed a vacuum for all those.
Floor now all clean and vacuumed, you reach Luke’s desk and bookshelf behind it. Many spaces on the shelves were free so packing the documents away in them was alright to do. You can just sort them for him and label each shelf with the contents. You had done this for Luke once in his other office. It wasn't as messy as his room is now, but Luke really enjoys your neat and tidy file sorting. He’s called it, “[Name]’s personal file service! Luke's only V.I.P service, right?~”
You giggle to yourself as you hear his voice through those words.
Unable to reach the higher shelves, you decided to save those for after every other thing that needed to be cleaned. His desk was just for area mapping, entry and exit routes to suspected buildings. Shifting them in a pile to the side of the table you hesitate if you wanted to peer through his desk cabinets. Personal or not, you would prefer if you had his permission first-hand.
Though i guess you were already invading his chambers without consent.
“I’m so sorry Luke. I will confess all my sins to your punishments when you get back, let me indulge in your personal affairs just this once.”
Shutting your eyes tight, you feel Peanut flap his wings and perch on your shoulder, eyes intently locked on the cabinet handle you were clutching. Opening one eye to watch Peanut you open the first drawer and crouch down to look closer.
The bottom is lined with thin files, scribbled notes, unopened letters, and craft utensils like the carving knife you found earlier. Not at all work-related, you could tell by the decorative ornaments that littered the box. Some were beads, pieces of jewelry, and preserved rose petals. Nothing matched Luke in this cabinet.
These were for you.
Luke has made many of things for gifts in the years spent together, you can recognize his crafts anywhere. And these were meant for you. This cabinet was all of you.
“..maybe I really shouldn’t have.” Peanut seemed to notice your surprise, shame and guilt. He chirped and flew down into the drawer hopping on the beads and letters as if finding something in that stack. “Peanut??! Hey hey, get out of there.”
His chirping grew persistent when spotting something in the far back of the cabinet. Dragging the item out with struggle, Peanut chips for you to help, so you worridly comply. Peanut would only do things on his own accord if, it was benefiting Luke, or, to embarrass Luke. You can’t tell which this is just yet.
Taking the wood block that Peanut dragged out to show you, you gap at the wood block.
It was a carving. A blooming rose so beautifully detailed and outlined down to the thinnest carve marks. A bird just like Peanut was the centerpiece in the rose, it sat at the middle in an angled side view as its wings raised to fly. You could tell it was unfinished because these types of carvings needed a thick coat of paint, and this was not at all painted just yet.
Dragging your hand across the carefully detailed and hard carve marks, you felt marks on the other side of the block when your hand moved. Stunned, you turn it around and freeze even further. Peanut tweeted and sat on your knee awaiting your final reaction. The back of the block was empty besides the small word carving on the bottom corner.
“Congratulations on your Graduation!!” A small sticky note wrote, “I always knew my Watson could push forth through the intense studying to earning your degree!! I’m really proud of you.” A small heart that was drawn in the corner of the sticky note was very light, as if he was hesitant to include it.
A bubble of sad inducing emotions threatened the peace and tranquility in your facade these past days. It prodded in your throat as your mouth was in a trembling frown, tears near slipping.
Peanut could feel the anguish radiating off you and chirped worridly, hopping closer to your face and rubbing his body against your skin. Fingers hardening against the wood, careful not to ruin it, you swallow the despair down and hold yourself.
“Luke…you silly boy….my graduation isn’t till about month from now.. You didn’t have to prepare so hard. Thank me in person if you’re so proud of me. That’s all I want..” The repeated words as if you were in a trance, were on the tip of your tongue but you didn’t dare speak those 3 words ‘I miss you.’
Inhaling deeply and exhaling you sniffle the rest of the sadness away and get up off the floor ready to finish the late-spring cleaning you started.
Peanut who still sat on your shoulder tilted his body at you. Patting his head and cooing at how good Peanut was in revealing Luke’s secrets, you hide the wood carving back in the drawer with your name basically plastered in it.
“Cleaning really helps cure some sadness.” Because a distraction was what you needed.
Getting that stepladder for dusting the bookshelf that you put off before, you reached the top shelf and make your way down. Pushing aside books so every corner was dirt-free, you notice Luke has a lot of thick detective books.
You snicker when you spot one light novel that you lent Luke because you thought he could brush up on modern romance stories. Luke said he lost the book in his bag, turns out that the book actually sat dust-free on his top shelf. ‘If you liked that light novel so much I would have gotten you the whole series Luke!’
Somehow you found that the second level of the bookshelf was dust-free, while even the bottom first shelf was super dusty. Strange. You didn’t find any of the books or locked files to be much interesting so you let that go. It might’ve been the case Luke is pursuing at the moment.
Sadly finished with the whole spring cleaning in Luke’s room, you watch the room as you exit and close the door in front of you slowly. It was high-time you study instead of reminiscing memories in your roommate/childhood friend/best friend’s room.
🔐[TimeSkip]🔍
—April 13
A hefty sigh rumbles through your throat into a groan.
“A new bestie is in order. What kind of person doesn’t even attend their best friend’s graduation ceremony? Peanut! Your father is absurd.” Same as normal, you sat in your room sighing and complaining to the Myna bird.
Peanut could never exactly escape this weekly routine every time your studying was complete and you had time to relax but that time was spent going crazy with the bird.
Though you had a reason to do so. Peanut hasn't been responsive as of these weeks, only when Luke was mentioned he would chirp quietly and stomp around to show aggravation. He has also gotten slimmer, without Luke who indulged Peanut in snacks way too much, Peanut ate only a necessary amount. No matter how much packs of dried figs—his absolute favorite snack—you bought, Peanut would eat four max then just sit on top of the bag.
Holding in another incoming sigh, you got up and stretched your arms above your head. “Come on Peanut, let’s go out today. Fresh air will free our shackles.” Swiftly slipping into your shoes at your front door, you call to the bird.
Peanut flew up and settled on your head, cozying up to your fluffy hair.
You both exit the apartment and out onto the lively streets. The bustling of people and chatter felt so distant. Only when a person is walking around and talking to another do you not notice how odd it is when you lose that company and instead walk alone hearing just the idle chats of random lives.
Perhaps Luke was feeling the same thing at this moment. You wish you could be connected to him like this.
The goal of movement was… unknown at the moment. You didn’t really know where to go when you suggested a walk.
“Parks are normally where people take strolls, right? Aghh…I’m talking as if I’m not normal and trying to BE normal..” I guess talking to yourself—and talking to a pet bird– isn’t very ordinary in the first place.
After arriving at the park and down a path towards the large constructed lake, you found a bench to rest on while Peanut happily ventures somewhere close by.
Sounds of the breeze and paces of people either jogging or walking past calms your mind of the occasional fog it gets on days like this with nothing to do but worry.
A guy riding a bicycle passes by but he doesn’t even leave your line of sight yet before the guy tumbles off the bike. You jolt up and rush over to help him up.
“Are you okay sir?!?? That was quite a tumble.” Holding a hand out as he sheepishly takes it and thanks you.
“Ah yes! Probably just a minor scratch on my knees, thank you for helping. I was in too much of a hurry to deliver these.” He rubs his neck then points towards the folded papers in his bicycle’s basket that have now spilled all over the grass.
“Oh, let me help!” You bent down to gather the papers and your hand freezes.
“I’m really sorry for having you help me twice like this! I’m grateful that you are so nice!!” He rambles on while grabbing the papers and stacking them back in the bicycle’s basket. “...and like–today was really busy so—work’s been piling up on me—...” Your ears couldn’t focus on the words and blocked out what he said. Your heart thumped loudly in your ears instead, the ringing of your mind engulfed your senses.
You were too fixated. On the front page of the newspaper.
“DETECTIVE LUKE PEARCE SOLVES A 15 YEAR ONGOING CASE IN LESS THAN 5 DAYS!”
“...what. What is this news report from.”
The stare you gave the guy was so intense that he falters for a moment. “Uhm, I work at the North Stellis newsletter station. Ah well, as a newspaper boy, so not really AT the news station ahha..” He sweats under the intensity of your shock but a question floated to his head.
“Oh? Do you know Mr. Pearce?! I heard of his work. Think he’s been at North Stellis for a month now.” You bit your lips hiding at the ecstatic smile and feelings that was bubbling up.
“I actually do! Can I take one of these newspapers home? I want to read it closely.” A relieved and joyous expression overcame your form as you held the paper close to your body.
The newspaper guy nodded with a smile, “Of course! Not much of a thanks for helping me, but if you need it then you're welcome to take it.”
“Ah! I need to get going now though. Thank you for helping me!” He hopped on his bike, waved a farewell then peddled away just as Peanut got back from his grandeur adventure.
Perching on your shoulder while you giggled in glee, Peanut chirped—albeit a chirp with much life unlike his usual quiet chirps—questionably
“Peanut! We’re going to see Luke!!!”
Peanut’s bewildered chirp was the last thing you heard before you went bolting home.
Tumblr media
Synopsis-> Luke the one who has always been by your side throughout school years. The one who wouldn’t hesitate to run back home to get you something you forgot and really needed. Luke who smiles so-so fondly at you when your smiles pierce through his bad days. The same Luke who thought running away from you would be beneficial for you.
It however, only served to push you out of your way to find him. Seeing your surroundings in an entire different city, you are in search of Luke by tracing his detective trails. His name plastered on the newspaper one day by accident, served you to find him quite quickly. Now by his side, the works of detectives and secret agents left you both to conquer swiftly.
Joining his line of work after thorough debating and arguing, he reluctantly let you invade his dangerous lifestyle. Of course–only with him by your side at all times.
aUgh,, this took awhile to finish🙇‍♀️
Lukey-boy, you will be in for a surprise😌😌
YAH. The next chap will take another decade since we will now officially start this series💀
Tags. @neigesprincess @crucnhice @backintomykpopphaseagain @kazedaka @little-aruma
78 notes · View notes
watchmorecinema · 1 year ago
Text
Normally I just post about movies but I'm a software engineer by trade so I've got opinions on programming too.
Apparently it's a month of code or something because my dash is filled with people trying to learn Python. And that's great, because Python is a good language with a lot of support and job opportunities. I've just got some scattered thoughts that I thought I'd write down.
Python abstracts a number of useful concepts. It makes it easier to use, but it also means that if you don't understand the concepts then things might go wrong in ways you didn't expect. Memory management and pointer logic is so damn annoying, but you need to understand them. I learned these concepts by learning C++, hopefully there's an easier way these days.
Data structures and algorithms are the bread and butter of any real work (and they're pretty much all that come up in interviews) and they're language agnostic. If you don't know how to traverse a linked list, how to use recursion, what a hash map is for, etc. then you don't really know how to program. You'll pretty much never need to implement any of them from scratch, but you should know when to use them; think of them like building blocks in a Lego set.
Learning a new language is a hell of a lot easier after your first one. Going from Python to Java is mostly just syntax differences. Even "harder" languages like C++ mostly just mean more boilerplate while doing the same things. Learning a new spoken language in is hard, but learning a new programming language is generally closer to learning some new slang or a new accent. Lists in Python are called Vectors in C++, just like how french fries are called chips in London. If you know all the underlying concepts that are common to most programming languages then it's not a huge jump to a new one, at least if you're only doing all the most common stuff. (You will get tripped up by some of the minor differences though. Popping an item off of a stack in Python returns the element, but in Java it returns nothing. You have to read it with Top first. Definitely had a program fail due to that issue).
The above is not true for new paradigms. Python, C++ and Java are all iterative languages. You move to something functional like Haskell and you need a completely different way of thinking. Javascript (not in any way related to Java) has callbacks and I still don't quite have a good handle on them. Hardware languages like VHDL are all synchronous; every line of code in a program runs at the same time! That's a new way of thinking.
Python is stereotyped as a scripting language good only for glue programming or prototypes. It's excellent at those, but I've worked at a number of (successful) startups that all were Python on the backend. Python is robust enough and fast enough to be used for basically anything at this point, except maybe for embedded programming. If you do need the fastest speed possible then you can still drop in some raw C++ for the places you need it (one place I worked at had one very important piece of code in C++ because even milliseconds mattered there, but everything else was Python). The speed differences between Python and C++ are so much smaller these days that you only need them at the scale of the really big companies. It makes sense for Google to use C++ (and they use their own version of it to boot), but any company with less than 100 engineers is probably better off with Python in almost all cases. Honestly thought the best programming language is the one you like, and the one that you're good at.
Design patterns mostly don't matter. They really were only created to make up for language failures of C++; in the original design patterns book 17 of the 23 patterns were just core features of other contemporary languages like LISP. C++ was just really popular while also being kinda bad, so they were necessary. I don't think I've ever once thought about consciously using a design pattern since even before I graduated. Object oriented design is mostly in the same place. You'll use classes because it's a useful way to structure things but multiple inheritance and polymorphism and all the other terms you've learned really don't come into play too often and when they do you use the simplest possible form of them. Code should be simple and easy to understand so make it as simple as possible. As far as inheritance the most I'm willing to do is to have a class with abstract functions (i.e. classes where some functions are empty but are expected to be filled out by the child class) but even then there are usually good alternatives to this.
Related to the above: simple is best. Simple is elegant. If you solve a problem with 4000 lines of code using a bunch of esoteric data structures and language quirks, but someone else did it in 10 then I'll pick the 10. On the other hand a one liner function that requires a lot of unpacking, like a Python function with a bunch of nested lambdas, might be easier to read if you split it up a bit more. Time to read and understand the code is the most important metric, more important than runtime or memory use. You can optimize for the other two later if you have to, but simple has to prevail for the first pass otherwise it's going to be hard for other people to understand. In fact, it'll be hard for you to understand too when you come back to it 3 months later without any context.
Note that I've cut a few things for simplicity. For example: VHDL doesn't quite require every line to run at the same time, but it's still a major paradigm of the language that isn't present in most other languages.
Ok that was a lot to read. I guess I have more to say about programming than I thought. But the core ideas are: Python is pretty good, other languages don't need to be scary, learn your data structures and algorithms and above all keep your code simple and clean.
16 notes · View notes
nectoy7 · 2 months ago
Text
The History of Java Programming: From Its Humble Beginnings to Dominance in Software Development
Java is one of the most influential programming languages in the modern era, known for its versatility, portability, and robustness. Developed in the early 1990s, it has left a lasting impact on the software industry, helping build countless applications, from mobile games to enterprise-level software. In this blog, we'll explore Java’s fascinating history, its motivations, its growth, and its influence on today’s technology landscape.
The Genesis of Java
Java originated in the early 1990s as part of a project at Sun Microsystems. The project, initially called the "Green Project," was led by James Gosling, alongside Mike Sheridan and Patrick Naughton. The team's goal was to develop a language for embedded systems, specifically for appliances like televisions, which were beginning to incorporate smart technology.
The language was initially called "Oak," named after an oak tree outside Gosling's office. However, due to a trademark conflict, it was eventually renamed Java. The name "Java" was inspired by a type of coffee popular with the developers, signifying their relentless energy and drive.
Motivation Behind Java's Creation
Java was developed to address several key challenges in software development at the time:
Portability: Most languages of the day, such as C and C++, were platform-dependent. This meant that software needed significant modification to run on different operating systems. Gosling and his team envisioned a language that could be executed anywhere without alteration. This led to the now-famous slogan, "Write Once, Run Anywhere" (WORA).
Reliability: C and C++ were powerful, but they had pitfalls like manual memory management and complex pointers, which often led to errors. Java aimed to eliminate these issues by offering features like automatic memory management through garbage collection.
Internet Revolution: As the internet began to take shape, Java was positioned to take advantage of this growing technology. Java’s platform independence and security made it an ideal choice for internet-based applications.
The Birth of Java (1995)
The Green Project initially produced a device called Star7, an interactive television set-top box. While innovative, it didn't achieve widespread success. However, by the mid-1990s, the internet was gaining traction, and Sun Microsystems realized Java’s true potential as a programming language for web applications.
In 1995, Java was officially launched with the release of the Java Development Kit (JDK) 1.0. At the same time, Netscape Navigator, a popular web browser, announced that it would support Java applets. This gave Java immense exposure and set the stage for its rapid adoption in the software development community.
Key Features that Set Java Apart
From the beginning, Java had several features that distinguished it from its contemporaries:
Platform Independence: Java programs are compiled into an intermediate form called bytecode, which runs on the Java Virtual Machine (JVM). The JVM acts as a mediator between the bytecode and the underlying system, allowing Java programs to be executed on any platform without modification.
Object-Oriented: Java was designed from the ground up as an object-oriented language, emphasizing modularity, reusability, and scalability. This feature made Java particularly attractive for building complex and large-scale applications.
Automatic Memory Management: Java's garbage collector automatically handles memory deallocation, reducing the risk of memory leaks and other errors that plagued languages like C and C++.
Security: Java was designed with a focus on security, particularly given its intended use for internet applications. The JVM serves as a secure sandbox, and Java’s bytecode verification process ensures that malicious code cannot be executed.
Evolution of Java Versions
Since its release in 1995, Java has undergone several iterations, each bringing new features and improvements to enhance the developer experience and address the evolving needs of software applications.
Java 1.0 (1996): The first version of Java was mainly used for applets on web browsers. It came with basic tools, libraries, and APIs, establishing Java as a mainstream programming language.
Java 2 (1998): With the release of J2SE (Java 2 Platform, Standard Edition), Java evolved from a simple web language to a complete, general-purpose development platform. Java 2 introduced the Swing library, which provided advanced tools for building graphical user interfaces (GUIs). This release also marked the beginning of Java Enterprise Edition (J2EE), which extended Java for server-side applications.
Java 5 (2004): Java 5, initially called Java 1.5, was a significant update. It introduced Generics, Annotations, Enumerations, and Autoboxing/Unboxing. The updated version also brought improved syntax and functionality, which simplified writing and reading code.
Java SE 7 (2011) and Java SE 8 (2014): Java SE 7 brought features like try-with-resources, simplifying exception handling. Java SE 8 was a transformative release, introducing Lambda expressions and Stream APIs. This version brought functional programming aspects to Java, allowing developers to write more concise and expressive code.
Java 9 to Java 17 (2017-2021): Java 9 introduced the module system to help organize large applications. Java 11 and later versions moved towards a more rapid release cadence, with new features appearing every six months. Java 17, released in 2021, became a long-term support (LTS) version, offering several advancements like improved garbage collection, pattern matching, and record classes.
The Java Community and OpenJDK
Java's development has always been characterized by a strong community influence. Initially controlled by Sun Microsystems, Java's fate changed when Oracle Corporation acquired Sun in 2010. After the acquisition, Oracle made significant strides towards making Java more open and community-driven.
OpenJDK, an open-source implementation of Java, became the reference implementation starting from Java 7. This move encouraged greater collaboration, transparency, and diversity within the Java ecosystem. OpenJDK allowed more organizations to contribute to Java’s development and ensure its continued growth.
Java in the Enterprise and Beyond
Java has become synonymous with enterprise-level software development, thanks in part to the introduction of Java EE (now known as Jakarta EE). Java EE provides a set of specifications and tools for building large-scale, distributed, and highly reliable applications. The Java ecosystem, including frameworks like Spring, Hibernate, and Apache Struts, has contributed to its popularity in enterprise environments.
Java also became a key player in the development of Android applications. Android Studio, Google's official IDE for Android development, is powered by Java, which contributed significantly to its widespread adoption. Although Kotlin, another JVM language, is now gaining popularity, Java remains a core language for Android.
The Challenges Java Faced
Despite its success, Java faced competition and challenges over the years. Languages like C#, developed by Microsoft, and Python have gained traction due to their developer-friendly features. Java has been criticized for its verbosity compared to more modern languages. However, the Java community’s active contributions and Oracle’s improvements, including adding modern programming paradigms, have kept it relevant.
Another significant challenge was the rise of JavaScript for web development. While Java was initially popular for web applets, JavaScript became the dominant language for front-end development. Java's relevance in web applications decreased, but it found its niche in server-side applications, enterprise systems, and Android.
Java Today and Its Future
Today, Java is one of the most popular programming languages globally, powering applications across various sectors, including finance, healthcare, telecommunications, and education. Java’s strength lies in its mature ecosystem, robust performance, and scalability.
The new six-month release cycle initiated by Oracle has brought excitement back into the Java world, with new features being added frequently, keeping the language modern and in line with developer needs. Java 17, as an LTS version, is a stable platform for enterprises looking for reliable updates and support over the long term.
Looking forward, Java’s evolution focuses on improving developer productivity, adding more concise language features, and optimizing performance. Java's adaptability and continuous evolution ensure its place as a leading language for both new projects and legacy systems.
Conclusion
Java’s journey from a language for set-top boxes to becoming a foundational tool in enterprise computing, Android applications, and beyond is nothing short of remarkable. Its creation was driven by a need for portability, reliability, and ease of use. Over nearly three decades, Java has evolved to remain relevant, keeping pace with technological advancements while preserving its core values of reliability and platform independence.
The language’s robust community, open-source development model, and wide adoption in critical applications guarantee that Java will remain a force in software development for many years to come. It has not only withstood the test of time but continues to thrive in a constantly changing technology landscape—an enduring testament to the vision of its creators and the collective effort of its global community.
2 notes · View notes
scumpsmallbrain · 1 year ago
Text
i love you static typing i love you pointers i love you memory management i love you structs i love you compiling i love you optimization i love you C programming language. i love you computers
10 notes · View notes
hob28 · 4 months ago
Text
Advanced C Programming: Mastering the Language
Introduction
Advanced C programming is essential for developers looking to deepen their understanding of the language and tackle complex programming challenges. While the basics of C provide a solid foundation, mastering advanced concepts can significantly enhance your ability to write efficient, high-performance code.
1. Overview of Advanced C Programming
Advanced C programming builds on the fundamentals, introducing concepts that enhance efficiency, performance, and code organization. This stage of learning empowers programmers to write more sophisticated applications and prepares them for roles that demand a high level of proficiency in C.
2. Pointers and Memory Management
Mastering pointers and dynamic memory management is crucial for advanced C programming, as they allow for efficient use of resources. Pointers enable direct access to memory locations, which is essential for tasks such as dynamic array allocation and manipulating data structures. Understanding how to allocate, reallocate, and free memory using functions like malloc, calloc, realloc, and free can help avoid memory leaks and ensure optimal resource management.
3. Data Structures in C
Understanding advanced data structures, such as linked lists, trees, and hash tables, is key to optimizing algorithms and managing data effectively. These structures allow developers to store and manipulate data in ways that improve performance and scalability. For example, linked lists provide flexibility in data storage, while binary trees enable efficient searching and sorting operations.
4. File Handling Techniques
Advanced file handling techniques enable developers to manipulate data efficiently, allowing for the creation of robust applications that interact with the file system. Mastering functions like fopen, fread, fwrite, and fclose helps you read from and write to files, handle binary data, and manage different file modes. Understanding error handling during file operations is also critical for building resilient applications.
5. Multithreading and Concurrency
Implementing multithreading and managing concurrency are essential skills for developing high-performance applications in C. Utilizing libraries such as POSIX threads (pthreads) allows you to create and manage multiple threads within a single process. This capability can significantly enhance the performance of I/O-bound or CPU-bound applications by enabling parallel processing.
6. Advanced C Standard Library Functions
Leveraging advanced functions from the C Standard Library can simplify complex tasks and improve code efficiency. Functions for string manipulation, mathematical computations, and memory management are just a few examples. Familiarizing yourself with these functions not only saves time but also helps you write cleaner, more efficient code.
7. Debugging and Optimization Techniques
Effective debugging and optimization techniques are critical for refining code and enhancing performance in advanced C programming. Tools like GDB (GNU Debugger) help track down bugs and analyze program behavior. Additionally, understanding compiler optimizations and using profiling tools can identify bottlenecks in your code, leading to improved performance.
8. Best Practices in Advanced C Programming
Following best practices in coding and project organization helps maintain readability and manageability of complex C programs. This includes using consistent naming conventions, modularizing code through functions and header files, and documenting your code thoroughly. Such practices not only make your code easier to understand but also facilitate collaboration with other developers.
9. Conclusion
By exploring advanced C programming concepts, developers can elevate their skills and create more efficient, powerful, and scalable applications. Mastering these topics not only enhances your technical capabilities but also opens doors to advanced roles in software development, systems programming, and beyond. Embrace the challenge of advanced C programming, and take your coding skills to new heights!
2 notes · View notes
sunbeaminfo · 3 months ago
Text
Tumblr media
Are you ready to take your C programming skills to the next level? Join Sunbeam Institute’s highly anticipated webinar on Advanced Pointers in C and become a master in one of the most crucial aspects of C programming. Pointers in C are more than just a feature; they are a powerful tool that allows you to directly manipulate memory, optimize code performance, and handle complex data structures with ease.
In this Advanced Pointer in C webinar, our expert instructors will dive deep into the concepts that are often challenging to grasp. You’ll learn:
How to effectively manage memory and avoid common pitfalls.
Techniques for handling arrays, strings, and dynamic memory allocation with pointers.
Understanding of pointer arithmetic and how to use it to manipulate data efficiently.
Tips for using pointers with functions and multi-dimensional arrays.
Best practices for debugging pointer-related issues in your code.
This webinar is perfect for experienced C programmers who want to refine their skills and apply advanced techniques to their projects. Whether you’re working on embedded systems, software development, or high-performance applications, mastering pointers will give you an edge in the competitive programming world.
Don’t miss this opportunity to learn from the best! Register now for Sunbeam Institute’s Advanced Pointer in C webinar and become an expert in one of the most powerful features of the C language.
Seats are limited, so secure your spot today!
0 notes
moose-mousse · 1 year ago
Text
Calling by reference in C++ Also known as STOP OVERTHINKING EVERYTHING
So I have now seen a specific type of horrible code from several programmers at my internship who really should know better. The code will look something like this:
Tumblr media
And when I ask how on earth they managed to overcomplicate "calling a function" I get the answer "I am calling by reference!" Which... no... no you are not. So, there are two ways to feed arguments to a function. Known as calling by value, and calling by reference. When you call by value, the compiler takes a COPY of whatever you send in, and your function works on that copy. (By the way, that is faster than calling by reference when you need to send in small primitive variables, since playing with a 64bit address is harder than moving the 16 bits an int often is ) What is happening in the... abomination of a function call here, is that they use a shared pointer. And shared pointers are a great tool! It gives you all the safety and easy of use of working in a single thread environment with a statically allocated variable (IE, a variable allocated on the stack) when you are working with dynamically allocated memory in a multi-threaded environment. But when you use it on a statically allocated variable in a single threaded environment... then.... it gives you all the safety and easy of use... that you already had... When I asked why on earth they were doing this to that poor poor pointer, I got told that it was because using raw pointers was bad... Ok... first of all, yes, raw pointers are bad. Not really in of themselves, but because c++ have better tools than them for 99% of use cases... But that is not a reason to use a pointer at all! When I told him he was calling this function by value... just in a really weird complicated way, he disagreed. He was using a pointer! Yes... you are putting in a pointer... which gets copied... And together with the work on creating the pointer and the more complicated syntax of using a pointer... it is just bad. You know how you call by reference? You do it... by calling... with a reference... Not a pointer, a REFERENCE. The hint is in the name! This is the refactored code:
Tumblr media
THAT is calling by reference. It is quick. It is clean. It is easy. The ONLY change from calling by value is in the signature. Both from the perspective of someone who uses the function and from inside the function, it works JUST like a call by value. Just like using a pointer, it allows you to work directly on a variable from an outher scope instead of copying the variable into the function. And unlike a pointer, a reference guarantees that whatever you are being feed is instantiated. You can send in a null pointer, you cannot send in a null reference (Well...Technically you can, but you have to work really hard to be able to.) Like... often in programming, the easiest way, that requires the least amount of work, is also often the most efficient and the easiest to maintain... just... just do it simply. I beg of you. Code models reality, and as a result can get really really complicated. So let us keep the simple things simple, yeah? ( By the way, I am grumping at programmers who should know better. When newbies makes weird coding choices, that is simply them learning. That is obviously fine )
11 notes · View notes
this-week-in-rust · 6 months ago
Text
This Week in Rust 550
Hello and welcome to another issue of This Week in Rust! Rust is a programming language empowering everyone to build reliable and efficient software. This is a weekly summary of its progress and community. Want something mentioned? Tag us at @ThisWeekInRust on X(formerly Twitter) or @ThisWeekinRust on mastodon.social, or send us a pull request. Want to get involved? We love contributions.
This Week in Rust is openly developed on GitHub and archives can be viewed at this-week-in-rust.org. If you find any errors in this week's issue, please submit a PR.
Updates from Rust Community
Foundation
Welcoming Rust-C++ Interoperability Engineer Jon Bauman to the Rust Foundation Team
RustNL 2024
Visual Application Design for Rust - Rik Arends
ThRust in Space: Initial Momentum - Michaël Melchiore
Arc in the Linux Kernel - Alice Ryhl
Making Connections - Mara Bos
Replacing OpenSSL One Step at a Time - Joe Birr-Pixton
Fortifying Rust's FFI with Enscapsulated Functions - Leon Schuermann
Oxidizing Education - Henk Oordt
Postcard: An Unreasonably Effective Tool for Machine to Machine Communication - James Munns
Introducing June - Sophia Turner
Robius: Immersive and Seamless Multiplatform App Development in Rust - Kevin Boos
Compression Carcinized: Implementing zlib in Rust - Folkert de Vries
K23: A Secure Research OS Running WASM - Jonas Kruckenberg
Async Rust in Embedded Systems with Embassy - Dario Nieuwenhuis
Xilem: Let's Build High Performance Rust UI - Raph Levien
Rust Poisoning My Wrist for Fun - Ulf Lilleengen
Type Theory for Busy Engineers - Niko Matsakis
Newsletters
This Month in Rust GameDev #51 - May 2024
Project/Tooling Updates
Enter paradis — A new chapter in Rust's parallelism story
Tiny Glade, VJ performances, and 2d lighting
Diesel 2.2.0
Pigg 0.1.0
git-cliff 2.3.0 is released! (highly customizable changelog generator)
Observations/Thoughts
The borrow checker within
Don't Worry About Lifetimes
rust is not about memory safety
On Dependency Usage in Rust
Context Managers: Undroppable Types for Free
Rust and dynamically-sized thin pointers
Rust is for the Engine, Not the Game
[audio] Thunderbird - Brendan Abolivier, Software Engineer
Rust Walkthroughs
Build with Naz : Rust typestate pattern
How to build a plugin system in Rust
Forming Clouds
Rust error handling: Option & Result
Let's build a Load Balancer in Rust - Part 3
The Ultimate Guide to Rust Newtypes
Miscellaneous
Highlights from "I spent 6 years developing a puzzle game in Rust and it just shipped, AMA"
Crate of the Week
This week's crate is layoutparser-ort, a simplified port of LayoutParser for ML-based document layout element detection.
Despite there being no suggestions, llogiq is reasonably happy with his choice. Are you?
No matter what your answer is, please submit your suggestions and votes for next week!
Calls for Testing
An important step for RFC implementation is for people to experiment with the implementation and give feedback, especially before stabilization. The following RFCs would benefit from user testing before moving forward:
RFCs
No calls for testing were issued this week.
Rust
No calls for testing were issued this week.
Rustup
No calls for testing were issued this week.
If you are a feature implementer and would like your RFC to appear on the above list, add the new call-for-testing label to your RFC along with a comment providing testing instructions and/or guidance on which aspect(s) of the feature need testing.
Call for Participation; projects and speakers
CFP - Projects
Always wanted to contribute to open-source projects but did not know where to start? Every week we highlight some tasks from the Rust community for you to pick and get started!
Some of these tasks may also have mentors available, visit the task page for more information.
No Calls for participation in projects were submitted this week.
If you are a Rust project owner and are looking for contributors, please submit tasks here or through a PR to TWiR or by reaching out on X (Formerly twitter) or Mastodon!
CFP - Events
Are you a new or experienced speaker looking for a place to share something cool? This section highlights events that are being planned and are accepting submissions to join their event as a speaker.
Scientific Computing in Rust 2024 | Closes 2024-06-14 | online | Event date: 2024-07-17 - 2024-07-19
Rust Ukraine 2024 | Closes 2024-07-06 | Online + Ukraine, Kyiv | Event date: 2024-07-27
Conf42 Rustlang 2024 | Closes 2024-07-22 | online | Event date: 2024-08-22
If you are an event organizer hoping to expand the reach of your event, please submit a link to the website through a PR to TWiR or by reaching out on X (Formerly twitter) or Mastodon!
Updates from the Rust Project
308 pull requests were merged in the last week
-Znext-solver: eagerly normalize when adding goals
fn_arg_sanity_check: fix panic message
add --print=check-cfg to get the expected configs
add -Zfixed-x18
also InstSimplify &raw*
also resolve the type of constants, even if we already turned it into an error constant
avoid unwrap diag.code directly in note_and_explain_type_err
check index value <= 0xFFFF_FF00
coverage: avoid overflow when the MC/DC condition limit is exceeded
coverage: optionally instrument the RHS of lazy logical operators
coverage: rename MC/DC conditions_num to num_conditions
create const block DefIds in typeck instead of ast lowering
do not equate Const's ty in super_combine_const
do not suggest unresolvable builder methods
a small diagnostic improvement for dropping_copy_types
don't recompute tail in lower_stmts
don't suggest turning non-char-literal exprs of ty char into string literals
enable DestinationPropagation by default
fold item bounds before proving them in check_type_bounds in new solver
implement needs_async_drop in rustc and optimize async drop glue
improve diagnostic output of non_local_definitions lint
make ProofTreeBuilder actually generic over Interner
make body_owned_by return the Body instead of just the BodyId
make repr(packed) vectors work with SIMD intrinsics
make lint: lint_dropping_references lint_forgetting_copy_types lint_forgetting_references give suggestion if possible
omit non-needs_drop drop_in_place in vtables
opt-in to FulfillmentError generation to avoid doing extra work in the new solver
reintroduce name resolution check for trying to access locals from an inline const
reject CVarArgs in parse_ty_for_where_clause
show files produced by --emit foo in json artifact notifications
silence some resolve errors when there have been glob import errors
stop using translate_args in the new solver
support mdBook preprocessors for TRPL in rustbook
test codegen for repr(packed,simd) → repr(simd)
tweak relations to no longer rely on TypeTrace
unroll first iteration of checked_ilog loop
uplift {Closure,Coroutine,CoroutineClosure}Args and friends to rustc_type_ir
use parenthetical notation for Fn traits
add some more specific checks to the MIR validator
miri: avoid making a full copy of all new allocations
miri: fix "local crate" detection
don't inhibit random field reordering on repr(packed(1))
avoid checking the edition as much as possible
increase vtable layout size
stabilise IpvNAddr::{BITS, to_bits, from_bits} (ip_bits)
stabilize custom_code_classes_in_docs feature
stablize const_binary_heap_constructor
make std::env::{set_var, remove_var} unsafe in edition 2024
implement feature integer_sign_cast
NVPTX: avoid PassMode::Direct for args in C abi
genericize ptr::from_raw_parts
std::pal::unix::thread fetching min stack size on netbsd
add an intrinsic for ptr::metadata
change f32::midpoint to upcast to f64
rustc-hash: replace hash with faster and better finalized hash
cargo test: Auto-redact elapsed time
cargo add: Avoid escaping double-quotes by using string literals
cargo config: Ensure --config net.git-fetch-with-cli=true is respected
cargo new: Dont say were adding to a workspace when a regular package is in root
cargo toml: Ensure targets are in a deterministic order
cargo vendor: Ensure sort happens for vendor
cargo: allows the default git/gitoxide configuration to be obtained from the ENV and config
cargo: adjust custom err from cert-check due to libgit2 1.8 change
cargo: skip deserialization of unrelated fields with overlapping name
clippy: many_single_char_names: deduplicate diagnostics
clippy: add needless_character_iteration lint
clippy: deprecate maybe_misused_cfg and mismatched_target_os
clippy: disable indexing_slicing for custom Index impls
clippy: fix redundant_closure suggesting incorrect code with F: Fn()
clippy: let non_canonical_impls skip proc marco
clippy: ignore array from deref_addrof lint
clippy: make str_to_string machine-applicable
rust-analyzer: add Function::fn_ptr_type(…) for obtaining name-erased function type
rust-analyzer: don't mark #[rustc_deprecated_safe_2024] functions as unsafe
rust-analyzer: enable completions within derive helper attributes
rust-analyzer: fix container search failing for tokens originating within derive attributes
rust-analyzer: fix diagnostics clearing when flychecks run per-workspace
rust-analyzer: only generate snippets for extract_expressions_from_format_string if snippets are supported
rustfmt: collapse nested if detected by clippy
rustfmt: rustfmt should not remove inner attributes from inline const blocks
rustfmt: rust rewrite check_diff (Skeleton)
rustfmt: use with_capacity in rewrite_path
Rust Compiler Performance Triage
A quiet week; we did have one quite serious regression (#115105, "enable DestinationPropagation by default"), but it was shortly reverted (#125794). The only other PR identified as potentially problematic was rollup PR #125824, but even that is relatively limited in its effect.
Triage done by @pnkfelix. Revision range: a59072ec..1d52972d
3 Regressions, 5 Improvements, 6 Mixed; 4 of them in rollups 57 artifact comparisons made in total
Full report here
Approved RFCs
Changes to Rust follow the Rust RFC (request for comments) process. These are the RFCs that were approved for implementation this week:
No RFCs were approved this week.
Final Comment Period
Every week, the team announces the 'final comment period' for RFCs and key PRs which are reaching a decision. Express your opinions now.
RFCs
Change crates.io policy to not offer crate transfer mediation
Tracking Issues & PRs
Rust
[disposition: merge] Allow constraining opaque types during subtyping in the trait system
[disposition: merge] TAIT decision on "may define implies must define"
[disposition: merge] Stabilize Wasm relaxed SIMD
Cargo
No Cargo Tracking Issues or PRs entered Final Comment Period this week.
Language Team
No Language Team RFCs entered Final Comment Period this week.
Language Reference
No Language Reference RFCs entered Final Comment Period this week.
Unsafe Code Guidelines
No Unsafe Code Guideline RFCs entered Final Comment Period this week.
New and Updated RFCs
No New or Updated RFCs were created this week.
Upcoming Events
Rusty Events between 2024-06-05 - 2024-07-03 🦀
Virtual
2024-06-05 | Virtual (Indianapolis, IN, US) | Indy Rust
Indy.rs - with Social Distancing
2024-06-06 | Virtual (Tel Aviv, IL) | Code Mavens
Rust Maven Workshop: Your first contribution to an Open Source Rust project
2024-06-06 | Virtual (Berlin, DE) | OpenTechSchool Berlin + Rust Berlin
Rust Hack and Learn | Mirror: Rust Hack n Learn Meetup
2024-06-09 | Virtual (Tel Aviv, IL) | Code Mavens
Rust Maven Workshop: GitHub pages for Rust developers (English)
2024-06-11 | Virtual (Dallas, TX, US) | Dallas Rust
Second Tuesday
2024-06-12 | Virtual (Cardiff, UK)| Rust and C++ Cardiff
Rust for Rustaceans Book Club: Chapter 8 - Asynchronous Programming
2024-06-13 | Virtual (Charlottesville, NC, US) | Charlottesville Rust Meetup
Crafting Interpreters in Rust Collaboratively
2024-06-13 | Virtual (Nürnberg, DE) | Rust Nuremberg
Rust Nürnberg online
2024-06-16 | Virtual (Tel Aviv, IL) | Code Mavens
Workshop: Web development in Rust using Rocket (English)
2024-06-18 | Virtual (Washington, DC, US) | Rust DC
Mid-month Rustful
2024-06-19 | Virtual (Vancouver, BC, CA) | Vancouver Rust
Rust Study/Hack/Hang-out
2024-06-20 | Virtual (Berlin, DE) | OpenTechSchool Berlin + Rust Berlin
Rust Hack and Learn | Mirror: Rust Hack n Learn Meetup
2024-06-25 | Virtual (Dallas, TX, US)| Dallas Rust User Group
Last Tuesday
2024-06-27 | Virtual (Charlottesville, NC, US) | Charlottesville Rust Meetup
Crafting Interpreters in Rust Collaboratively
2024-07-02 | Virtual (Buffalo, NY) | Buffalo Rust Meetup
Buffalo Rust User Group
2024-07-03 | Virtual | Training 4 Programmers LLC
Build Web Apps with Rust and Leptos
2024-07-03 | Virtual (Indianapolis, IN, US) | Indy Rust
Indy.rs - with Social Distancing
Europe
2024-06-05 | Hamburg, DE | Rust Meetup Hamburg
Rust Hack & Learn June 2024
2024-06-06 | Madrid, ES | MadRust
Introducción a Rust y el futuro de los sistemas DLT
2024-06-06 | Vilnius, LT | Rust Vilnius
Enjoy our second Rust and ZIG event
2024-06-06 | Wrocław, PL | Rust Wroclaw
Rust Meetup #37
2024-06-11 | Copenhagen, DK | Copenhagen Rust Community
Rust Hack Night #6: Discord bots
2024-06-11 | Paris, FR | Rust Paris
Paris Rust Meetup #69
2024-06-12 | Reading, UK | Reading Rust Workshop
Reading Rust Meetup
2024-06-18 | Frankfurt/Main, DE | Rust Frankfurt Meetup
Rust Frankfurt is Back!
2024-06-19 - 2024-06-24 | Zürich, CH | RustFest Zürich
RustFest Zürich 2024
2024-06-20 | Aarhus, DK | Rust Aarhus
Talk Night at Trifork
2024-06-25 | Gdańsk, PL | Rust Gdansk
Rust Gdansk Meetup #3
2024-06-27 | Berlin, DE | Rust Berlin
Rust and Tell - Title
2024-06-27 | Copenhagen, DK | Copenhagen Rust Community
Rust meetup #48 sponsored by Google!
North America
2024-06-08 | Somerville, MA, US | Boston Rust Meetup
Porter Square Rust Lunch, Jun 8
2024-06-11 | New York, NY, US | Rust NYC
Rust NYC Monthly Meetup
2024-06-12 | Detroit, MI, US | Detroit Rust
Detroit Rust Meet - Ann Arbor
2024-06-13 | Spokane, WA, US | Spokane Rust
Monthly Meetup: Topic TBD!
2024-06-17 | Minneapolis, MN US | Minneapolis Rust Meetup
Minneapolis Rust Meetup Happy Hour
2024-06-18 | San Francisco, CA, US | San Francisco Rust Study Group
Rust Hacking in Person
2024-06-20 | Seattle, WA, US | Seattle Rust User Group
Seattle Rust User Group Meetup
2024-06-26 | Austin, TX, US | Rust ATC
Rust Lunch - Fareground
2024-06-27 | Nashville, TN, US | Music City Rust Developers
Music City Rust Developers: Holding Pattern
Oceania
2024-06-14 | Melbourne, VIC, AU | Rust Melbourne
June 2024 Rust Melbourne Meetup
2024-06-20 | Auckland, NZ | Rust AKL
Rust AKL: Full Stack Rust + Writing a compiler for fun and (no) profit
2024-06-25 | Canberra, ACt, AU | Canberra Rust User Group (CRUG)
June Meetup
South America
2024-06-06 | Buenos Aires, AR | Rust en Español | Rust Argentina
Juntada de Junio
If you are running a Rust event please add it to the calendar to get it mentioned here. Please remember to add a link to the event too. Email the Rust Community Team for access.
Jobs
Please see the latest Who's Hiring thread on r/rust
Quote of the Week
Every PR is Special™
– Hieyou Xu describing being on t-compiler review rotation
Sadly, there was no suggestion, so llogiq came up with something hopefully suitable.
Please submit quotes and vote for next week!
This Week in Rust is edited by: nellshamrell, llogiq, cdmistman, ericseppanen, extrawurst, andrewpollack, U007D, kolharsam, joelmarcey, mariannegoldin, bennyvasquez.
Email list hosting is sponsored by The Rust Foundation
Discuss on r/rust
2 notes · View notes
catonator · 1 year ago
Text
Addendum: Game Engines
The post about Unity I wrote yesterday was the longest one I’ve published so far, and even then I feel like I left out about a hundred things. One of the most important ones I wanted to talk about was complexity.
When I first moved away from Game Maker in 2018, I really couldn’t imagine actually writing my own games without using a premade engine. I mean, Game Maker is a massive tool that’s been developed for decades, and the source must have thousands of lines of code, right?
Well, yes. But you don’t need to recreate Game Maker. You can make a lot happen with something called MVP; Minimum Viable Product. Let’s look at a practical example.
Super Mario Bros.. Released in 1985, for the Nintendo Entertainment System. Somehow I doubt it ran on Unity.
Objects!
Tumblr media
Let’s start with the most important part: the stuff that moves around and does things.
Now, I’ve looked at SMB1’s engine code, and it actually kind of sucks, so I’ll instead focus on a high-level version of a system that matches what SMB1 has, but doesn’t recreate it one to one. Remember, I want to encourage you to get something made yourself, in your own chosen language and framework, instead of getting stuck looking at hex and memory address behaviour.
We can define an object as something that’s interactable, and can change its state. This locks out stuff like the background bushes, clouds, mountains and also the ground (since it remains constant). However, this means that something like brick blocks and question mark blocks are objects.
In its simplest form, an object base would have a few parameters that every object in the game have: X and Y coordinates, current object state, and whether the object is active or not.
Most of the objects in SMB1 are either very boxy or actually just boxes, so for collision we’ll simply use an axis-aligned bounding box.
How you make the object do, you know, object things, probably depends on what language you’re using. In C I’d use some sort of overcomplicated function pointer array to point to object state functions. In more modern (and reasonable) languages like C#, Java and even C++ you’d probably just inherit the class and make the language figure out what to do with the object.
Tumblr media
As for actually managing the objects, well that’s quite simple. The camera in SMB1 moves to the right, and never backtracks, so in essence you just have to worry about objects that appear from the right side of the screen. If you spawn objects only as they’d appear on the screen, and despawn them as soon as they disappear off the left side of the screen, you can easily get away with just a fixed-size array of say, 32 indices, and a for loop to update the active objects.
Tumblr media
My very first game was quite literally just this. It’s as basic as it gets, and it totally works!
Level creation!
Generally speaking, one of the most frustrating parts in game development are level creation tools. Without a level, you don’t really have a game, and if your tools suck ass and level creation is a pain, your game won’t turn out so good. As of writing this, I’ve spent about 3 months writing a pretty comprehensive level editor for Radium. However, your first game (super mario) won’t be as complicated. We’ll use something tangible as an example again!
Let’s look at world 1-4, the first Bowser castle. At first glance it looks rather complicated, there’s floor, a ceiling, both change height at several points, there’s pits, all sorts of traps. It looks like a cohesive place.
Tumblr media
But remember, video games are all smoke and mirrors. Ultimately all of this is just numbers in memory.
With that in mind, if you stare at the stage for a while, you might start noticing some strange details. Ignoring all enemies and simply looking at the ground, you might notice that the level never features any overlapping geometry. Bricks and question mark blocks may occasionally form platforms, but as far as the ground and ceiling goes, there are never any overhangs, tunnels, multi-layered passthroughs… it’s simply all solid blocks.
SMB1 constructs its worlds by defining a floor and ceiling height. The level itself is constructed by placing markers along the stage that change the floor and ceiling height from that point onward. If the floor is 0 grid units high, it’s a bottomless pit. Therefore, if you simply wanted to make a clone of the world generator and Mario’s player controller, the collision detection would at its simplest be whether or not Mario’s feet are below the ground level. For walls, you can scan the stage forward by Mario’s width and see if the ground level changes at all. If it does, you can check if it’s again higher than Mario’s feet level.
Thus, we have a level creation toolset that doesn’t even require tiles. It might not be suitable for a WYSIWYG approach to level design (for that I’d recommend Tiled or similar), but for a starting position you can quite literally just hardcode a list of ceiling/floor height change instructions separated by N amounts of tiles. Level design without an editor.
Conclusion
That’s not all I could talk about, but I already feel like this is a lot to swallow. Stuff like sprite batching, tile rendering, texture atlases etc. are all topics you'll probably encounter sooner or later. I'd really love to go on about stuff like this, but I'm trying to avoid writing a book. My hopes with this post are to showcase that making games outside of the carefully curated toolsets of modern engines isn’t always as difficult as you’d imagine. The likes of Unity and Unreal have made us believe that game engines are gigantic, unscalable mountains of code. In truth, a game engine is simply something that runs a game.
When I started my engine journey in 2018, I hadn't really realized this. I jumped to MonoGame because I thought custom engines were rad, but I didn’t really know how to actually make an engine, let along a game in one. It didn’t take long to figure just how many corners you can cut to just make something work in the most basic of senses. For every challenge, you have infinite solutions, far beyond the templatized ones provided to you by online Unity tutorials.
I made the source code for my first ever custom game open when I finished the game. It was written in about 2 weeks, and during the production I learned MonoGame, C# and engine design philosophies, all for the first time in my life. You can take a gander at it here and witness it in all its hacky glory. Despite that, it’s a game that you can play.
I’ve also opened up the questions page on my Tumblr, so maybe I can assist with some issues you may have when starting out. I hope I’ve at least inspired you to give a shot for outside the box thinking. The game you want to make may be a lot simpler than you initially imagined.
Happy carefree programming!
5 notes · View notes
eccentric-nucleus · 1 year ago
Text
the bulk of this c++ -> haskell conversion is going fine b/c a lot of it is just... legible lines of code that do some stuff. but. at the core of the vertexpool code there's these functions that do a whole lot of pointer dereferencing and arithmetic and do a bunch of math to make a bunch of pointers that they store and then use later on in various ways, and i'm still struggling to figure out what they even do much less how to correctly replicate them in haskell. manual memory management has its charm but oh boy i'm never gonna be able to debug this code if it's wrong
2 notes · View notes
brainlesstechnerd · 1 year ago
Text
Introduction: As a high school student in the 21st century, there's no denying the importance of computer science in today's world. Whether you're a seasoned programmer or just dipping your toes into the world of coding, the power of computer science is undeniable. In this blog, I'll share my journey as a 12th-grader venturing into the fascinating realms of C, C++, and Python, and how this journey has not only improved my computer science profile but also shaped my outlook on technology and problem-solving.
Chapter 1: The Foundations - Learning C
Learning C:
C, often referred to as the "mother of all programming languages," is where my journey began. Its simplicity and efficiency make it an excellent choice for beginners. As a high school student with limited programming experience, I decided to start with the basics.
Challenges and Triumphs:
Learning C came with its fair share of challenges, but it was incredibly rewarding. I tackled problems like understanding pointers and memory management, and I quickly realized that the core concepts of C would lay a strong foundation for my future endeavors in computer science.
Chapter 2: Building on the Basics - C++
Transition to C++:
With C under my belt, I transitioned to C++. C++ builds upon the concepts of C while introducing the object-oriented programming paradigm. It was a natural progression, and I found myself enjoying the flexibility and power it offered.
Projects and Applications:
I started working on small projects and applications in C++. From simple text-based games to data structures and algorithms implementations, C++ opened up a world of possibilities. It was during this phase that I began to see how the knowledge of programming languages could translate into tangible solutions.
Chapter 3: Python - The Versatile Language
Exploring Python:
Python is often praised for its simplicity and readability. As I delved into Python, I realized why it's a favorite among developers for a wide range of applications, from web development to machine learning.
Python in Real-Life Projects:
Python allowed me to take on real-life projects with ease. I built web applications using frameworks like Flask and Django, and I even dabbled in data analysis and machine learning. The versatility of Python broadened my horizons and showed me the real-world applications of computer science.
Chapter 4: A Glimpse into the Future
Continual Learning:
As I prepare to graduate high school and venture into higher education, my journey with C, C++, and Python has instilled in me the importance of continual learning. The field of computer science is dynamic, and staying up-to-date with the latest technologies and trends is crucial.
Networking and Collaboration:
I've also come to appreciate the significance of networking and collaboration in the computer science community. Joining online forums, participating in coding challenges, and collaborating on open-source projects have enriched my learning experience.
Conclusion: Embracing the World of Computer Science
My journey as a 12th-grader exploring C, C++, and Python has been an enlightening experience. These languages have not only improved my computer science profile but have also given me a broader perspective on problem-solving and technology. As I step into the future, I'm excited to see where this journey will take me, and I'm ready to embrace the ever-evolving world of computer science.
If you're a fellow student or someone curious about programming, I encourage you to take the plunge and start your own journey. With determination and a willingness to learn, the world of computer science is yours to explore and conquer.
2 notes · View notes