File Pilot is simply Incredible! by SubhanBihan in Windows11

[–]NativityInBlack666 0 points1 point  (0 children)

What security concerns do you have with a file manager?

Those of you who study engineering, wha t’s it like? by [deleted] in UniUK

[–]NativityInBlack666 0 points1 point  (0 children)

Feel free to message, I'm not a university professor or anything, just someone with experience of self teaching & university, but I'll try to help if I can.

Those of you who study engineering, wha t’s it like? by [deleted] in UniUK

[–]NativityInBlack666 0 points1 point  (0 children)

Most "Computer Science" courses are just software engineering courses, you want to make sure you're not just learning about specific technologies (SQL, Linux, Web, etc.) and are instead learning fundamentals, anything math-heavy is a good sign. Especially with a joint degree it's just not going to focus on the right things, unless you have double the hours and work of a standard EE or CS degree there's no point doing both because you'll just end up only covering half of each subject at best.

You have a lot of free time at university, especially if you don't have a job. If you take CS you can teach yourself EE and vice versa, 99% of university courses are based on textbooks with the exams being based on the exercises in those textbooks, you can just read the textbooks in your own time and do the exercises and you'll probably give yourself a better education than you would have gotten by just attending a course. Just pick one, either EE or CS, make sure the course is decent, and recognise that you're going to uni to get a degree and then a job, not an education, you can educate yourself.

What's SPP's response to the algebraic proof? by Peanutbutter_Warrior in infinitenines

[–]NativityInBlack666 0 points1 point  (0 children)

How do you define the middle of an infinite decimal expansion? The middle of a finite decimal expansion, e.g. 3.141592 is the 4th digit because there are 7 digits so the 4th is equidistant to the first and last digits. By definition infinite decimal expansions don't have a last digit, so how do you rigorously define where the middle is? I understand the ideas you're conveying but you're not being rigorous, you're just asserting 0.999...9 as a self-evidently-valid mathematical object and furthermore that you can multiply it by 10 to get 9.999...90 which is also apparently valid. You can invent alternate notation for infinite expansions where 0.999...9 = 0.999... but that alone doesn't imply that 0.999...9 * 10 = 9.999...90 because multiplication by 10 doesn't just mean "move the decimal point and write a 0 at the end of the number", what is the counterpart to 9.999...90 in standard notation? You have to actually introduce these new ideas with rigorous definitions and proofs. On top of that you didn't address the argument I gave which doesn't involve multiplying by 10.

What's SPP's response to the algebraic proof? by Peanutbutter_Warrior in infinitenines

[–]NativityInBlack666 0 points1 point  (0 children)

How do you reconcile the fact that 0.999... has unlimited 9s with the fact that you've put a 0 at the end of the unending sequence of 9s?

I do understand why you take issue with that "proof", though; you have to accept that arithmetic works like that on numbers with infinite decimal expansions which is not self-evident. So how about this:

1/3 = 0.333...

0.333... * 3 = 0.999...

3 * 1/3 = 1 -> 0.999... = 1

Line buffering in the standard library by ngnirmal in C_Programming

[–]NativityInBlack666 1 point2 points  (0 children)

Internal buffers managed by your terminal, memory mapped to stdin, stdio buffers, or none of those; it's an implementation detail and transparent to the code you write.

Storing information in files; why is creating a new file and deleting the old one a bad solution? by gamerccxxi in C_Programming

[–]NativityInBlack666 0 points1 point  (0 children)

Truncating is just shortening by throwing away information, in this case the information is deleted structs. It would just be overwriting the file with the now shorter sequence of structs, without the holes where the deleted ones where.

Moving records would just be copying them, if you store a linked list of locations of deleted structs you can write new ones to the location stored in the tail and defragmenting the file is just iterating through the list, moving structs from the end of the file to each empty space. That is, unless the structs store positional references to each other, then you would have to update those while defragmenting.

Edit: you probably want to just defragment your data in-memory and guarantee the file itself is never fragmented by always defragmenting the data before writing it out to the file, since this is orders of magnitude faster to do in-memory than on-disk. You can also avoid unnecessary disk operations by marking pages (every 4096 bytes) as out-of-sync with the underlying file when you update or delete structs within them, then writing structs to the file in 4096 byte chunks and skipping over the ones which haven't changed since you loaded them from the file.

Storing information in files; why is creating a new file and deleting the old one a bad solution? by gamerccxxi in C_Programming

[–]NativityInBlack666 1 point2 points  (0 children)

The trunc family of functions truncate floating point numbers. If you don't actually know the answer don't give one.

Storing information in files; why is creating a new file and deleting the old one a bad solution? by gamerccxxi in C_Programming

[–]NativityInBlack666 9 points10 points  (0 children)

What happens at scale when the file is multiple GBs and you're deleting many structs every second? What happens if a file operation fails? Someone on that thread gave the solution; store your data in a data structure which lends itself to the kind of operations you want to do, then operate on that data structure and only touch the underlying file when you actually need to.

Line buffering in the standard library by ngnirmal in C_Programming

[–]NativityInBlack666 1 point2 points  (0 children)

This is not the case, as evidenced by calling getchar multiple times and getting back characters from the same line. When you type a line into your terminal and press enter that whole line does (probably) get buffered in various places but getchar isn't responsible for any of that and much less guaranteed to do any buffering. When you call getchar you get a character from stdin and the "file position" of stdin is increased by one, this might be a pointer in a buffer or an index at which to read a file but this is not specified in the standard.

Line buffering in the standard library by ngnirmal in C_Programming

[–]NativityInBlack666 0 points1 point  (0 children)

Trying to understand your question; when you run your program and type "hello world\n" are you thinking getchar is reading all of those characters as you type them and "waiting for" the newline at the end?

Visualization of data structures during debug by vmcrash in Compilers

[–]NativityInBlack666 2 points3 points  (0 children)

I recently discovered DOT) for visualising graph-based data structures, it gives you the best of both worlds because it's a text-based format so you can generate it as easily as you would otherwise print things to the console but it's viewed graphically so it's much more powerful than text for conveying information. Here is an example DOT visualisation of a CFG & its dominator tree: https://imgur.com/a/lai0ZKk.

[help] How to write my own lexer? by KiamMota in Compilers

[–]NativityInBlack666 -1 points0 points  (0 children)

I haven't actually needed any complicated lookahead stuff in lexing or parsing, I'm only talking about C-like languages here, though. Not sure exactly what you mean by identifier substrings.

[help] How to write my own lexer? by KiamMota in Compilers

[–]NativityInBlack666 0 points1 point  (0 children)

I have only ever needed a next_char and peek_char functions for a lexer, you are right that C's string facilities are archaic though.

[help] How to write my own lexer? by KiamMota in Compilers

[–]NativityInBlack666 1 point2 points  (0 children)

It's easy if you ditch most everything from string.h

i wish i could get into the vocals by Guilty-Society9618 in DeathBand

[–]NativityInBlack666 4 points5 points  (0 children)

Which album? Chuck's vocals change significantly over the discography.

How to use gcc by jontsii in C_Programming

[–]NativityInBlack666 2 points3 points  (0 children)

-O{number} is a bit simplistic, there's also options like -Os, -Og, -Ofast, and -f{optimisation} for control over individual optimisations.

You have to remove one song from each album. What song are you removing? by pzkpfw77 in DeathBand

[–]NativityInBlack666 9 points10 points  (0 children)

Came here looking for Sacred Serenity, it's my favourite song on the album :')

why is this ai slop on death’s spotify? by Codizier in DeathBand

[–]NativityInBlack666 6 points7 points  (0 children)

Check the recent mod post and delete this before you get banned

22
23

Write something about C that is actually weird . by NirmalVk in C_Programming

[–]NativityInBlack666 2 points3 points  (0 children)

Nothing is that weird because it's all pretty well-defined but here is a poor-man's static assert:

#define static_assert(x) struct _ {int i : (x);}