[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology

Name
Options
Comment
Verification
4chan Pass users can bypass this verification. [Learn More] [Login]
File
  • Please read the Rules and FAQ before posting.
  • You may highlight syntax and preserve whitespace by using [code] tags.

08/21/20New boards added: /vrpg/, /vmg/, /vst/ and /vm/
05/04/17New trial board added: /bant/ - International/Random
10/04/16New board for 4chan Pass users: /vip/ - Very Important Posts
[Hide] [Show All]


🎉 Happy Birthday 4chan! 🎉


[Advertise on 4chan]


File: 1733615462780915.jpg (434 KB, 1440x1918)
434 KB
434 KB JPG
what does dereferencing a null pointer do
>>
>>106769607
CPU is hardcoded to call an exception handler from the OS kernel, also I hate women
>>
>>106769607
you're trying to reach for a value at a memory address through a pointer that doesn't point to a valid address, which results in undefined behavior
>>
>Lust Provoking Image
>Irrelevant Time-Wasting Question
>>
>>106769752
>I have nigger-level impulse control please don't post women
>>
>>106769607
Access memory at page zero
if it isn't mapped or has the wrong protection it causes a page fault.
>>
>>106769607
ignore the others. ((they)) don't want you to find out.
>>
>>106769764
>pretending to be retarded
brown outing himself as usual lol
>>
>>106769607
I look pretty much like this
>>
>>106769764
you rely on people having nigger level impulse control to click on your thread in the first place
>>106769607
SEXO

vgh what does touching a nice perky asian laddy titty feel like
>>
>>106769607
Not sure but probably tries to access 0x0000...0 or something
>>
>>106769607
Just by sitting like this a woman(female girl) can get any job in IT
>>
>>106769976
>laddy titty
?
>>
>>106769607
Post 3 asshole
>>
>>106769607
https://www.youtube.com/watch?v=dFIqNZ8VbRY
>>
>>106769764
>I'm not naked
>I'm wearing a microkini
>>
File: apu_coomer.jpg (13 KB, 231x218)
13 KB
13 KB JPG
>>106769607
sorry, can you repeat the question? i got distracted
>>
>>106770071
was a typo but probably checks out
>>
>>106769607
I fucking hate coming on this site and have to see women it makes me feel alone
>>
>>106770605
Western society has been subverted into praising (too much) open sexuality as 'empowering.'

East Asian societies, that exhibit some form of slut-shaming, while also being societies that produce their own pornography, seem to have kept a better balance of things.

I mean, I love sluts and whores, but we also gotta run an operation here, people.
The 'evil' motive in empowering sexuality is shifting the power balance towards the female sex, which itself is more susceptible to propaganda, etc.
>>
>>106769649
The CPU has no idea pointers exist, that's schizo shit humans and compilers made up. Dereferencing a null pointer results in undefined behavior, what happens exactly depends on your specific hardware and software.
>>
>>106770605
You should interact with women until you know them enough to hate them
>>
>>106770751
>while also being societies that produce their own pornography
pornography is illegal in all civilized east asian countries
>>
File: 1648874301869.gif (1.92 MB, 398x494)
1.92 MB
1.92 MB GIF
>>106770805
Yeah, that's why it's all pixelated, right?

...gee, what the fuck is *your* motive?
>>
File: 1754183320369201.png (180 KB, 492x519)
180 KB
180 KB PNG
>>106770805
>all civilized east asian countries
>civilized
Wait, never mind, I get it.
>>
>>106770059
What if they can't do the job
>>
>>106770752
>The CPU has no idea pointers exist
it knows the instruction pointer exists
>>
>>106770313
barely child-like enough for me to fap
>>
>>106770937
In what architecture? Usually you just have instructions to read/write from memory addresses. Both when you dereference a pointer and when you access a variable directly, in assembly you're usually just saying "read from location [x] in ram into register [y]"
>>
plastic chink women sexxo
>>
>>106771027
how do you think function calls work?
>>
>>106769607
open your eyes
>>
>>106771107
You write shit you will need to the stack, then you use a flow control instruction to modify the value in the program counter register. How this modification happens depends on the specific architecture. You might be overwriting it, adding something to it, or doing something else. I'm not sure how branches work in the cpu architectures that are common today
>>
File: Haerin.webm (3.01 MB, 720x720)
3.01 MB
3.01 MB WEBM
No longer references a pointer which is null
>>
>>106771027
>In what architecture?
In every architecture. The instruction pointer is a physical register on the machine, retard.
>>
>>106771312
oh yeah ok I'm retarded, I read that as "the instruction called pointer" for some reason
>>
File: peep.png (152 KB, 902x841)
152 KB
152 KB PNG
monolids are more erotic than A&T
>>
>>106771224
Now post her without makeup.
>>
File: file.png (528 KB, 750x543)
528 KB
528 KB PNG
>>106771642
>>
>>106770805
Ah yes indonesia, the civilized crown jewel of asia. Known for its magnificent trash-free beaches
>>
>>106771651
Unfortunate.
>>
>>106769607
>what does dereferencing a null pointer do
https://www.youtube.com/watch?v=bLHL75H_VEM
>>
>>106769607
SEX WITH CUTE ASIAN WOMEN SEX WITH CUTE ASIAN WOMEN SEX WITH CUTE ASIAN WOMEN
>>
>>106769607
dont worry buddy youll learn by mid terms
>>
>>106769607
Why does she have men's underwear?
>>
>>106773397
Anon...
>>
File: 9nkoX2Q.jpg (125 KB, 1280x959)
125 KB
125 KB JPG
>>106769607
what happens when you try to reach for the toilet paper, but not only there's no paper, but there's no roll at all?
>>
>>106769736
0 is a valid address in virtual memory, its just protected
>>
>>106769607
>what does dereferencing a null pointer do
https://youtu.be/0Gg12j_4e3Q?t=26
GAH
>>
>>106769607
it causes troons to dial 8
>>
>>106770605
step 1: get reasonably /fit/
step 2: talk to girls you find attractive IRL and ask for contact info
step 3: date and fuck
repeat until you've found a girl you think matches well with you (ignore the first few because you'll probably fall in love with any girl that gives you attention)
>>
>>106769607
Undefined behavior. Means literally anything could happen, which is the opposite of what you want as a programmer.
In practical terms it usually means the OS kills your program for being a retard.
>>
>>106769607
semen demon (affectionate)
>>
>>106771224
It would piss me off to have to "try and be cute and hopefully someone will make a meme of it through sheer luck".
Just get a job. Your soul is ablaze.
>>
>>106769607
i need SEXO WITH IMPREGNATION with a cute girl so bad.
>>
I'm a sub 5 male.
>>
>>106774351
this only works if
>1) your face is good enough
>2) your skeletal proportions (height, shoulder:hip ratio, shoulder:waist ratio) are good enough
>3) you can naturally reach 21-23 FFMI/you use steroids
I'd add hair as a factor but if you get really big you can get laid through the ork/ogre route so just roid.

if you're a gay alien lanklet with a weird face you will die alone. if you're a 5'4" dwarf you will die alone. if you are skinnyfat/bald and refuse to take steroids you will die alone.
>>
>>106775513
either your standards are too high from being terminally online, or you've never tried
only total shreks with genetic deformities turning them into stephen hawkings and potatoes are undateable.

Dating in the current year is pretty busted for certain personality types (this is the most important part), but everyone is expected to fail like 50 times
good job on getting psyoped though, makes it easier for everyone else with the competition taking themselves out.
>>
>>106769607
There are 2 options
1) it works. You access information at location 0, and break something
2) more likely it doesnt work, system abandons your program & runs someone elses program that outputs an error message.
>>
>>106769607
>>106775584
asian women with pointy faces like that are so fucking perfect
those bitches are looksmaxxed as hell though so I bet they only want 6'5 gigachad
>>
>>106775745
Not true. I've had a chinese fwb like that for two years while in college. Pointy face, petite, huge knockers. She moved back to china after graduation though.

Technology.
>>
>>106773532
the best explanation of null pointers I've seen
>>
>>106769736
>undefined behavior
>literally anything can happen
>nothing ever came of it despite almost half a century of UB tripping
>>
>>106769607
the os maps virtual memory into real physical ram. if you attempt to access a page that has not been assigned to your process by the kernel then the kernel will throw an exception and halt the program, aka segfault. you can set up a handler and recover from this state if you want to, but unless you have a specific reason, e.g, you want to “automatically” allocate more pages as you run out of some address range of virtual memory then it is probably pointless to do so. by convention, you never generally have access to a 0 address but there are exceptions to this. on embedded systems that don’t have virtual memory schemes, dereferencing a null may be a valid operation. an embedded system might not even define NULL to be (void)0 and instead it might be some arbitrary value. this can be especially dangerous if you attempt to call a null function pointer because the chip will actually make that jump and start reading instructions from that address which is a hardcore fucky wucky
>>
>>106769607
it's an undefined behavior that will vary platform to platform. on x86 you will just segfault (crash).
>>
>>106769607
It will point to a null value, now kys with those stupid questions
>>
>>106773397
Im not seeing it
>>
>>106769607
Depends on your architecture.
Your computer probably uses MMU that is made to throw a hardware fault when you do so and your operating system handles it by aborting your process.
Some other architectures, especially the ones with no MMU might just have valid addresses at zero. Some even use zero page as a part of ram that is faster and can be accessed using shorter instruction variants.
>>
Specifically nullptr, like in C++? Architecture-specific, like these guys are saying: >>106776421 >>106776567 >>106779642

More common in practice is dereferencing an uninitialized pointer, which can have any value in it. In this case, again, architecture-specific undefined behavior, but if you don't segfault from attempting to access memory you're not permitted, you can have even wilder errors. You can hit SIGILL, for instance, or even continue with a value the processor doesn't immediately reject (e.g. you try dereferencing an uninitialized int*). Basically, you're just reading from somewhere or other in memory, and it's not obvious what happens next.
>>
>>106769607
Depends on the system, but you should see it in terms of reading from the wrong location. Some systems will segfault because address 0 is common convention for "i have no idea what i should do with this pointer right now". Failing fast is better than reading junk data and doing God knows what. To sell the point home, there's nothing stopping you from making a pointer into an allocation and then deciding that address is null for your conventions. Your program will still work.
>>
File: file.png (1.18 MB, 757x1000)
1.18 MB
1.18 MB PNG
>>106774351
no gym for your face
>>
>>106775584
>either your standards are too high from being terminally online, or you've never tried
you say this because you had a good roll on the genetics check.

the average male makes the cut, just barely, to where effort can get them laid. but lots of anons here are simply below the minimum threshold and the minimum threshold keeps rising.

there is zero utility for a human female to pick me when she can just share a better male, get with a superior man from an inferior race (immigrant, of whom there is a male surplus) or simply flick her bean to women's "literature".
>>
File: 1757623524980443.gif (496 KB, 800x450)
496 KB
496 KB GIF
>>106769607
segmentation fault (core dumped)
>>
>>106769607
null is just 0, dereferencing is reading from that address, so you're reading the very first byte(s) of memory
since that's a protected region, the OS or kernel shuts down the program or something
>>
>>106775513
number numbers numbers, stats stats stats, jesus fuck bro life isn't an RPG you autistic faggot.

>>106774351
>(ignore the first few because you'll probably fall in love with any girl that gives you attention)
Holy THIS
>>
File: boxers.png (1.31 MB, 2142x1035)
1.31 MB
1.31 MB PNG
>>106779544
>>
>>106781774
>life isn't an RPG you autistic faggot.
yes it is, it's just janky as shit, poorly balanced, unfairly dominated by a small pareto front of dice rolls and the guides are all garbage
>>
>>106770128
This is such a good talk.
Highly recommended for anyone remotely interested in how computers work under the hood.
The part about the way caches work is truly crazy shit.
>>
>>106775584
>t. above average genetics
>>
>>106782251
They're comfy and easy to wear.
>>
>>106783359
but negative feminine, makes me think she doesn't cook or clean either
>>
>>106782251
>>106773397
they're shorts, she also has a sports bra because the dress she's wearing is seethrough, she's not gonna walk around with her underwear clearly visible, think a little
>>
>>106783438
Lol. What the fuck is this logic?
>>
>>106769607
#include <iostream>

int main() {
int* ptr = nullptr;
std::cout << ptr << std::endl;

return 0;
}


it's just a pointer to 0 in virtual memory and IIRC what's stored there is always just 0
>>
>>106784148
>ptr = 0
>print(ptr)
>0
wow, good job, have you tried actually dereferencing it?
>>
>>106769607
No call stack. All g0ne.
>>
>>106784181
i explained what it does
nullptr is just 0
#include <iostream>

int main(){
bool num = (bool)nullptr;
std::cout<<num<<std::endl;
}
>>
File: 1701581553683490.jpg (70 KB, 735x905)
70 KB
70 KB JPG
>>106769607
>what does dereferencing a null pointer do
If you dereference a null pointer your dick will shrivel up and fall off. Got it?
>>
>>106776263
retard
>>
>>106784300
you fucking casted it to bool right there, you mongoloid. of course it's going to be 0
>>
>>106783476
wearing seethrough clothes would be just fine but white panties is just a bridge too far? she's clearly slutting it up just for the camera anyway so why not go the full distance, think a little

>>106783504
women not wearing female clothes are a red flag, it's as simple as that. combine it with being a camwhore that doesn't even commit to it and well, not an image worth saving if i put it that way
>>
>>106771027
values that represent addresses have been called pointers in low level jargon since the 1960s. you are having a pedantic moment that is literally 60 years too late. kill yourself you larping faggot.
>>
>>106769607
>what does dereferencing a null pointer do
it reads or writes the value at address 0
in every major OS, the page at address 0 is not mapped to any memory, which causes a page fault. the OS sees this, sees that there is no valid memory at address 0, and causes an exception in your program. if you don't handle this exception, your program will be terminated.
in other environments, you may be able to read or write at address 0. such as microcontrollers. or 16-bit DOS applications.
>>106774491
>Undefined behavior. Means literally anything could happen
>>106769736
>undefined behavior
>>106770752
>Dereferencing a null pointer results in undefined behavior
>>106776567
>undefined behavior
>>106779783
>undefined behavior

anyone blabbing about undefined behavior is a brainless zombie, don't listen to these fags
>>
>>106784616
Can you even map 0 page on x86?
>>
>>106784634
You can. There are even ways to map the 0 page on Windows. Calling NtAllocateVirtualMemory with an address between 1 and 4095 will give you allocated memory in the 0 page and allow you to freely dereference null pointers (at least on Windows 7, I haven't tried on Windows 10). I don't know whether you can do this on Linux. Anyway, this proves that it is possible to access the 0 page in x86 and x64.
>>
>>106784658
Thanks.
>>
A pointer is variable whose value is location. You can go to this location and read/write the value at that location. This is known as dereferencing the pointer.

If the pointer is null that means its value is null. This implies that null is a location, or otherwise it would not be a pointer. Exactly what kind of location null is- is implementation defined.
>>
>>106784300
>nullptr is just 0
yeah, now dereference it
>>
OPEN YOUR EYES
>>
>>106769607
it's hilarious how even in carefully staged photos you can still see the absolute deformed mongoloid skull under all the surgery and filters
>>
>>106769607
It give your computer a headache
>>
>>106771651
Still would
>>
>>106769607
i need a asian gf so bad but most of them are owned by black bfs nowadays
>>
>>106780629
bro I'm 5'3"
>>
>>106783359
And they don't squeeze the balls.
>>
>>106771651
left is better
>>
>>106783476
>buying see through cloths only to also buy opaque cloths to wear under them
women please
>>
>>106787838
it's called style
she could've worn the opaque clothes and been ugly dressed, but now with a seethrough dress she's really sexy, you get that?
also, wanting to see even more slutted up chicks in public is just porn-brain mentality that's ruining decency, stop complaining that she's wearing too much, start complaining that she's not wearing enough
>>
>>106787882
that's too much projection for me to respond seriously to at this early hour on a weekend
>>
>>106787896
it's not projection, because I'm not projecting my flaws onto you, it's predicting, I'm generalizing your response into a group which has similar opinions
>>
>>106787911
It is objectively projection because not only did I not imply something, it wasn't even on my mind. You made up what you thought I thought.
>>
>>106769607
Is she chink or gook?
>>
File: IMG_0891.jpg (14 KB, 480x360)
14 KB
14 KB JPG
>>106780585
you idiot you do it for your grandma to call you handsome you stupid ni

come young one, tell giganigga your problem.
>>
>>106784658
>Calling NtAllocateVirtualMemory with an address between 1 and 4095 will give you allocated memory in the 0 page and allow you to freely dereference null pointers
    let mut base = 1_usize;
let mut size = 4096_usize;

let ret = unsafe {
NtAllocateVirtualMemory(
NtCurrentProcess,
&mut base as *mut usize as *mut _,
0,
&mut size as *mut _,
0x00001000, // MEM_COMMIT
0x40, // PAGE_EXECUTE_READWRITE
)
};

Getting 0xC0000018 STATUS_CONFLICTING_ADDRESSES on Windows 11. Maybe it's already allocated with NO_ACCESS and has to be deallocated first?
>>
>>106788131
why not nip?
>>
>>106769607
SEX. The behavior of dereferencing a null pointer depends on many factors. The language implementation, the configuration of your CPU, the optimization level your program was compiled at, whether you have a valid object at the address or not at the time of dereferencing. It is too hard to say without knowing more.
>>
>>106769607
thread 'main' panicked at src/main.rs:5:9:
null pointer dereference occurred
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread caused non-unwinding panic. aborting.
>>
>>106788131
She's Korean. Her IG has more pictures.
>>
File: file.png (125 KB, 652x454)
125 KB
125 KB PNG
>>106770752
why dont they just define it
>>
>>106790619
>The behavior of dereferencing a null pointer depends on many factors.
But why?
What's so special about 0?
>>
>>106790861
Different hardware does different things with address 0. The MCU I use at work, address 0 holds the address of the stack. Some hardware traps dereferences of 0, some doesn't. From the language side of things, it's less about anything special about address 0 and more about the fact that dereferencing a pointer of type T to an address A is UB if there is not an object of type T there.
>>
>>106769607
divides by zero.
>>
the thing is that we don't know
>>
>>106769607
Is does a CPU-accelerated raise(SIGSEGV) if you're on Linux.
>>
>>106775513
>but if you get really big you can get laid through the ork/ogre route so just roid.
no attractive girls in their prime (18-24) year olds like roided out guys. only girls that lift but they're also on steroids and are effectively FTM
>>
>>106790111
they fixed it in a security update to Windows 7, so anything newer than Windows 7 definitely won't support this. anyway, the point is not that you can necessarily rely on this behavior in general purpose windows applications, but that you can do it in the x86 architecture. (program pictured was run in 64 bits mode, but i think it works on 32 bit as well)
>>
>>106790111
>>106794243
by the way, the page above the 0 page is already used for something else apparently, so if you specify a size and address such that the total allocation will extend beyond the 0-page, then you get STATUS_CONFLICTING_ADDRESSES. If you simply try to allocate just the 0-page on a version of Windows that already has the check to disallow it, then you get STATUS_INVALID_PARAMETER_2. Otherwise, you get STATUS_SUCCESS and you can dereference null pointers all you want.
>>
>>106769607
why are her hands so big
>>
>>106770128
posts like these are why I still click on shitpost threads
>>
>>106769607
Were you asking a question?
>>
>>106769607
It ... ah...
... it makes coffee.
>>
>>106769607
Nothing, dereference is an abstract C semantic
>>
File: Focal_length.jpg (58 KB, 300x600)
58 KB
58 KB JPG
>>106794736
physics
>>
>>106790703
Source?
>>
>>106769649
Nah, that's configured by the kernel. There's nothing inherently special for VA page 0 from the CPU's POV.
>>
>>106797067
I am pretty sure this is not true. CPU likely treats virtual address 0 in a special way during speculative execution, like not trying to prefetch TLB until the access is know to be non-speculative. Otherwise CPU would waste cycles and cache bandwidth on every mispredicted branch:
if (ptr)
>>
>>106797295
When you do if (ptr), the CPU doesn't know it's a pointer. It just views that number as an integer up until the point you try to dereference it (i.e. add [rax], 100). The actual test for null would just be a test rax, rax -> jz .IsNull and unless the cpu does some really weird stuff trying to cross-correlate these instructions, it won't have any idea.
>>
>>106797736
My example wasn't very good. It should be more like:
if (cond) {
*ptr = x; // pointer is never NULL in this block
}

If branch predictor predicts that "cond" is true, the CPU will start doing "*ptr = x" speculatively and so if "ptr" is NULL, the CPU will have to do the table walk to translate zero address, which will never succeed (will always return "page missing" and thus the result won't be cached, making CPU to do this procedure every time again and again).

CPUs likely restrict such prefetching from the first and the last pages.
>>
>>106784616
>describes undefined behavior
>anyone blabbing about undefined behavior is a brainless zombie, don't listen to these fags
never change /g/
>>
File: 1731748747960078.jpg (238 KB, 1125x1776)
238 KB
238 KB JPG
>>106796804
2_13kg
don't bother, she's a cunt
>>
>>106784148
>>106784300
A troll or just retarded? You be the judge.
>>
>>106794736
oh SHIT, so that's why HE is wearing male underwear..



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.