Skip to main content
32 events
when toggle format what by license comment
Sep 14, 2021 at 8:32 answer added Noob timeline score: 1
Dec 15, 2015 at 17:17 vote accept Sudip Bhandari
Dec 15, 2015 at 17:01 comment added JimmyB Sometimes, you just don't know the address of a variable at compile time; at other times, you want to do the same thing on multiple different variables instead of duplicating code for every one of those variables. malloc is just a special case of the former: At compile time, you can't possibly know where the allocated memory will reside at runtime.
Dec 15, 2015 at 15:25 comment added gronostaj Use of any variable is a memory overhead.
Dec 15, 2015 at 12:53 vote accept Sudip Bhandari
Dec 15, 2015 at 17:17
Dec 15, 2015 at 11:59 comment added Yogu Note that a far more relevant performance drawback of pointers is the potential cache miss that results from the indirect memory access.
Dec 15, 2015 at 9:11 comment added Joshua Bakker As long as you don't forget to remove pointers you don't use anymore, it's okay. Also, if you got enough work memory, one pointer doesn't matter. But if you use too many without removing (especially if you don't need most of the pointers), you're in big trouble.
Dec 15, 2015 at 8:45 answer added paj28 timeline score: 0
Dec 15, 2015 at 6:45 comment added Emil Laine Usually in time-critical applications you avoid pointers as much as possible, because of the indirection overhead (think cache misses).
Dec 15, 2015 at 1:27 comment added robert bristow-johnson @DocBrown , while it might be true that the OP does not fully understand the purpose of pointers, it's a legit question, so i will undo your -1 with my +1, i think the two top-rated answers miss the boat entirely.
Dec 15, 2015 at 0:12 answer added Cort Ammon timeline score: 0
Dec 14, 2015 at 21:19 history tweeted twitter.com/StackProgrammer/status/676511831905710081
Dec 14, 2015 at 18:10 comment added zwol Memory overhead (along with its evil twin, cache unfriendliness) is a major reason why linked lists are discouraged nowadays.
Dec 14, 2015 at 17:21 comment added Michael Shaw This has the feel of some ones homework assignment. The question is designed to explore if the answer understands pointers and how they are used.
Dec 14, 2015 at 17:13 comment added Ben Voigt (Blog post showing the performance benefit: blog.juma.me.uk/tag/compressed-oops)
Dec 14, 2015 at 17:06 comment added Ben Voigt @ErikEidt: Actually, one JVM got a rather significant performance boost when they recognized the wastefulness of full-sized 64-bit pointers and switched to using indexes instead.
Dec 14, 2015 at 16:54 answer added user204677 timeline score: 3
Dec 14, 2015 at 15:29 answer added utnapistim timeline score: 1
Dec 14, 2015 at 15:19 comment added Doc Brown -1, the whole question is based on a very deep misconception - the OP has obviously not understood the purpose of pointers.
Dec 14, 2015 at 13:37 comment added MSalters Addresses can be stored in registers, so the assumption is already wrong.
Dec 14, 2015 at 12:05 answer added Lightness Races in Orbit timeline score: 6
Dec 14, 2015 at 10:53 comment added PJTraill How about passing a (large) struct argument by address? If you count that as a pointer variable, it is unavoidable for many algorithms, and uses far less space than passing the struct by value!
Dec 14, 2015 at 10:53 answer added Krrish Raj timeline score: 5
Dec 14, 2015 at 10:20 answer added Lawrence timeline score: 5
Dec 14, 2015 at 8:27 comment added Basile Starynkevitch A pointer might sit in registers or be passed as an argument. In both cases there is no obvious memory overhead. And the pointer might be computed (e.g. thru pointer arithmetic, functions returning pointers, etc)
Dec 14, 2015 at 5:32 answer added robert bristow-johnson timeline score: 12
Dec 14, 2015 at 4:49 comment added Erik Eidt How do you think other languages (Java,C#,...) store references to objects? (Hint: they use pointers).
Dec 14, 2015 at 2:37 answer added Mike Nakis timeline score: 35
Dec 14, 2015 at 2:32 answer added Telastyn timeline score: 37
Dec 14, 2015 at 2:27 comment added James McLeod The benefits of dynamic memory allocation vastly outweigh the cost of the pointer.
Dec 14, 2015 at 2:15 review First posts
Dec 14, 2015 at 11:50
Dec 14, 2015 at 2:10 history asked Sudip Bhandari CC BY-SA 3.0