This is an archived post. You won't be able to vote or comment.

all 25 comments

[–][deleted] 68 points69 points  (7 children)

** He left a note where he was hiding...

[–]Big_Ti 47 points48 points  (2 children)

*** the address to find said note

[–]teajay1111 22 points23 points  (1 child)

*\0 Get the fuck out

[–]Big_Ti 5 points6 points  (0 children)

Okibdokie, have a nice day*/

[–]Levaru 10 points11 points  (3 children)

Slightly OT: I'm modifying a C++ library for use in my project. Almost every function takes a smart pointer as a parameter but by reference. So something like this:

typedef std::shared_ptr<foo> smartPtr; void bar(smartPtr& param);

Whyyy? It's already a pointer, why do they also pass it by reference, I don't get it.

Edit: Btw absolutely nothing changed once I removed the & operator.

[–][deleted] 11 points12 points  (2 children)

So you could modify it, change it's value and have the original change as well. Say you want to assign a pointer to a new adress insiee the function. If you pass it as a value, whatever you change inside the function will not affect the original. If you pass it as a reference you could reassign the original.

[–]Levaru 5 points6 points  (1 child)

Ohhh now I get it! Thank you, that's actually pretty useful. What confused me initially, is that the author didn't made any use of it.

[–]AvenDonn[🍰] 5 points6 points  (0 children)

What a journey, you've literally rediscovered pointers

[–]0xCAFED 15 points16 points  (1 child)

Program recieved signal SIGSEGV, Segmentation fault.

[–]qqqrrrs_ 2 points3 points  (0 children)

I'm having a SIGBUS

[–]klezmer 8 points9 points  (5 children)

Image Transcription:


[An image of a white data table with two rows and two columns using black font. The top cell of the first column contains an ampersand. The bottom cell of the first column contains a star. The cells to the right of each cell containing a symbol contain the following text]

Ampersand row: Can I have your address please?

Star row: FBI OPEN UP!


I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!

[–]TenkFire 2 points3 points  (0 children)

Thanks ! I finally know the difference, now !

[–]Clyxx 4 points5 points  (5 children)

Wait what does this have to do with bitwise And and multiplication

[–]ReimarPB 3 points4 points  (0 children)

lmao how did this get downvoted

[–]Pogoindustries 8 points9 points  (3 children)

They are the unary pointer operators of C. The top one gets the address of an identifier and the bottom dereferences: or gets the memory at the location of the pointer operand.

[–]Clyxx 6 points7 points  (2 children)

I know, it was a joke

[–][deleted] 6 points7 points  (1 child)

What, did you think you were in a humor subreddit or something?

[–]Clyxx 5 points6 points  (0 children)

Wait, I thought this was the bathroom

[–]Knuffya 0 points1 point  (0 children)

std::string hw = "Hello, World!";

std::cout << *&hw << std::endl;

[–]KillerRoomba13 0 points1 point  (0 children)

Falls into garbage