Thread Rating:
  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5

[Guide] Pointers and Strings

#2
I read through. I was waiting the entire time for you to put "int len = " and to use the for loop with the variable instead of the full statement. And I saw at the end. You so, so made me wait for it. Finna

Honestly, I see a lot of programmers make that particular mistake. What they don't realize is that in many languages, len(some string) is an O(n) operation. A single "for (i = 0; i < strlen(string); i++)" operation becomes an O(n^2) operation just like that.

I'm glad that there is a surge of programmers (along with resources to get them started). The science of things like this is anything but beginner friendly, but at some point, however, it becomes necessary to know. Things like this are exactly why a very solid backing in the inner-workings of low-level code are so important.

Also, I'm very surprised that the OS takes things a single byte at a time. On one hand, operations that involve computations on a single byte have no choice. (32 or 64 bits does not mean 4 or 8 operations. Just that one operation is 32 or 64 bits. And a simple "is this character 'x'" operation is an 8 bit operation fundamentally.) I suppose I'm always a little slow to use string operations for that reason, but when I do use them, I use the available tools. Regex is great (still doesn't make total sense to me, but I have the hang of it enough to know my way around it).

But copying/writing strings is something where I'm surprised on that one. I suppose there is a reason for this too, or perhaps it's convention also (much like 75% of the C++ language. Tongue)

--------------------------------------------------
Regarding 1.9MB Javascript libraries...
I couldn't agree more. Not only with javascript (because the browser has to load these and that takes time), but in principle, just in general. If I can do something WITHOUT a framework, why not? Seriously. 90% of the time, it's not hard to do without. (You already have to learn the base language. With a framework, you have to learn the base language AND the framework. It's like learning two languages to do one thing.)

That's something I LOVE about MyBB. Yes, they use Jquery (I'm okay with that, jquery makes javascript much easier), but they don't use symfony or any other PHP libraries. The pages are in actual .php files. It's not modernized at all, but it's so, so much cleaner and easier to code for. Unfortunately, the world is moving towards more bloated approaches, and people don't appreciate the simplicity of old ways like they used to.

Anyway, thanks for writing this! I really like your post, and learned a lot just reading through it. Smile

Reply


Messages In This Thread
[Guide] Pointers and Strings - by Lain - March 12th, 2020 at 5:02 AM
RE: [Guide] Pointers and Strings - by Darth-Apple - March 12th, 2020 at 2:59 PM
RE: [Guide] Pointers and Strings - by Lain - March 12th, 2020 at 11:13 PM
RE: [Guide] Pointers and Strings - by Darth-Apple - March 20th, 2020 at 12:12 AM



Users browsing this thread: 1 Guest(s)

Dark/Light Theme Selector

Contact Us | Makestation | Return to Top | Lite (Archive) Mode | RSS Syndication 
Proudly powered by MyBB 1.8, © 2002-2024
Forum design by Makestation Team © 2013-2024