The pointer addr
is actually undefined, and currently points to some random every time it is executed. Could this be where the memory protection is being triggered, preventing access to other segments?
Yup, that’s me, President of the agAdbefdsds…what, where am I?
The pointer addr
is actually undefined, and currently points to some random every time it is executed. Could this be where the memory protection is being triggered, preventing access to other segments?
But I am trying to read memory assigned by addr
variable, which seems to work just fine on the textbook example? (see pic in the link)
However, when I try to do the same, I get this:
$ ./a.out
Address of main function: 401166
Address of addr variable: 3f4c4310
Enter a (hex) address: 3f4c4310
Enter number of bytes to view: 40
Address Bytes Characters
------- ------------------------------- ----------
Segmentation fault
Those are really slow, even slower than the European ones, so I don’t bother adding them.
I don’t know the specifics, but why would 5 bits be a problem on a 16bit machine?
Because I’m assuming that there’s only 16 bits, right, and hence these have to be divided between hours, minutes and seconds:
5 + 6 + 5 = 16 bits in total. This is why the last one makes no sense, unless the timeformat precision was restricted to 2 seconds?
But during the release of MS-DOS, there were only 16-bit microprocessors, right? 32-bit x86 processors came way later around 1985, I think?
This seems to be the likely answer. I’m assuming that it has something to do with the technological limitation of 16 bit. 1981 saw the first 32-bit non-x86 microprocessor (Intel iAPX 432), and MS-DOS was released for 16-bit in mind, like the 8086. Perhaps, the highest size of the integer was limited to 16 bit as well, and with that in mind, they had to make sure to create a non-padded struct for time, in which the hour were allotted 5 bits (= 32 ≈ 24hour), minutes were allotted 6 bits (= 64 ≈ 60mins). The last remaining 5 bits were assigned to seconds, and with the remaining bit-fields, the best precision they could come up with gave a 2-second interval. Is that a fair reasoning?
Since there’s no answer from Guix users over here, well, I use Guix as my main distro. The language choice is superior to Nix’s half-Haskell DSL. However, the bigger issue with Guix is the lack of maintainers. NodeJS hasn’t been updated since the last five year and Zig lacks a lot of packages. Another big issue is the centralized GNU server, which can fail at any moment. Their servers are all located in either the USA, or Europe, and for Asia, downloading NARs with such slow speed is a pain in the ass.
No FHS compatibility seems fine but certain programs require it and don’t have nix native workarounds.
Nix, as well as Guix, both have the option to enable FHS emulation to resolve this issue.
Things like developer-only scripts with hardcoded #!/bin/bash shebangs are more likely to break on NixOS than they would on a conventional Linux distro with Nix installed.
This can be substituted or patched to - it’s an easy fix. The actual issue is contamination of environment, caused by mismatching glibc-locale between the host package and third-party package.
What do they spy on, the explosive diarrhea?
Imagine being offended by “woke” stuff and not actual bigotry. I wonder who’s the real snowflake?
The duality of the previous and current post is…confusing. I was under the assumption that Poland is a Christo-fascist state? Or is it not?
It’s not a success. Two-state solution is a failure. Be it India-Pakistan, East-West Germany, North-South Korea or Sudan-South Sudan.
As someone from India, the two-state solution for India-Pakistan was a massive disaster. One of the worst man-made catastrophe. Rape, murder and violence between different ethnic groups, it was horrible. People were forcibly displaced to the other side of the country, leaving behind their ancestral village and belongings. This destroyed their culture and their language, stripped their identity.
These states were divided to satisfy the egoes of the two major political dynasts, Nehru and Jinnah, and as typical of pretend-socialist liberals, they were supported by the Hindu Mahasabha and the All India Muslim league.
Pakistan forced the use of Urdu, an Indian language, because their native languages had Devanagari-resembling script, and for that strong Muslim identity they went for a language with a Farsi script… except that the language was Khadi Boli (a language from UP) with borrowed Farsi words.
Well, what about India? They went ballistic sub-nationalist. State majoritarians forced language on vulnerable groups, including mine (obligatory middle-finger to the Basel Mission and Kannada chauvinists).
Later, Pakistan’s ethnic cleansing and rape of Bengalis, especially Hindus in East Pakistan (East Bengal) backfired, and the country broke into three. Cut to 2024, the people of Kashmir suffer even to this day.
If only the Indian communists from the HSRA had not been betrayed by the INC, a greater India with none of the communal B.S. would have existed. There would have been no Hindutva or Deobandi extremists jump around and squirming like cockroaches. And we have two countries armed to the brim with nuclear weapons.
Economically, somewhere between Qatar and Lebanon. Palestine’s sea near Gaza has a rich source of oil. They also allow ships to cross through, which is a nice source of income. Culturally, they probably have something in common with the Lebanese and Egyptians.
Scriptkiddies doing the bare-minimum to profit over other’s hard-work. They’re not going to survive, because they don’t know shit about the internal workings of their product, they won’t be able to scale it quickly, and sooner or later, they’ll run out of money, if it’s not the poor publicity killing their product.
I was going to write a lot of stuff about my own experience, but then I decided that it wasn’t worth writing and getting my identity exposed, so I’ll say “same”, minus the disowning part, because I come from a collectivist society. My failure as an mid-20s adult is theirs to blame, because that’s how broken I am, and I still can’t cope with the past. Tough-love my ass.
Bath towels: Daily (I bath twice in a day)
Bedding: Every week
“Stalin threw my expensive Roquefort, so I demand apology”
I’m interested to see the future of QuickJS, TinyJS and Duktape.
This worked for me - I think
%p
fixed the issue of incorrect representation, as well as input. I also triedunsigned long int
, which works in place ofuintptr_t
, but I’m assuming that it isn’t portable.Resolved code snippet
/* Allows the user to view regions of computer memory */ #include <ctype.h> #include <stdint.h> #include <stdio.h> typedef unsigned char BYTE; int main (void) { uintptr_t addr; int i, n; BYTE *ptr; printf ("Address of main function: %p\n", (void *) &main); printf ("Address of addr variable: %p\n", (void *) &addr); printf ("\nEnter a (hex) address: "); scanf ("%p", &addr); printf ("Enter number of bytes to view: "); scanf ("%d", &n); printf ("\n"); printf (" Address Bytes Characters\n"); printf (" ------- ------------------------------- ----------\n"); ptr = (BYTE *) addr; for (; n > 0; n -= 10) { printf ("%8X ", (uintptr_t) ptr); for (i = 0; i < 10 && i < n; i++) printf ("%.2X ", *(ptr + i)); for (; i < 10; i++) printf (" "); printf (" "); for (i = 0; i < 10 && i < n; i++) { BYTE ch = *(ptr + i); if (!isprint (ch)) ch = '.'; printf ("%c", ch); } printf ("\n"); ptr += 10; } return 0; }