sepp2k's Profile User Rating: *****

Reputation: 2013 Grandmaster
Group:
Mentors
Active Posts:
3,046 (2.95 per day)
Joined:
21-June 11
Profile Views:
49,414
Last Active:
User is online 21 minutes ago
Currently:
Viewing Board Index

Previous Fields

Country:
DE
OS Preference:
Linux
Favorite Browser:
Who Cares
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Who Cares
Your Car:
Who Cares
Dream Kudos:
0
Expert In:
C/C++, Functional Programming, Java, Python, Computer Science
Icon   sepp2k has not set their status

Posts I've Made

  1. In Topic: pointer question of function

    Posted 20 Apr 2014

    That's not a pointer of a function, that's a function returning a pointer. That is getValue simply returns a char pointer.
  2. In Topic: Calling conventions for passing arguments to functions

    Posted 18 Apr 2014

    No, you can't implement function calls using a fixed memory address to pass the arguments. I mean you could, but then it would be impossible for functions to be recursive.

    However that doesn't mean you can't store the arguments in memory - it just can't be at a fixed address. Usually arguments and local variables are stored using a call stack. How this works is you store a memory address in a register (called the stack pointer) and when you call a function, the stack pointer is incremented by the amount of local memory needed by that function and the function's parameters, local variables and temporary values that can't be stored in registers will be stored in the section of memory between where the stack pointer previously pointed to and where it points to now. Then when you call another (or possibly the same) function from your function, the stack pointer will be incremented again, so none of your locals will be overwritten by the other function's locals. Then when the function returns, the stack pointer just gets decremented again, so the next time a function is called, the returning function's locals are overwritten because you don't need them anymore.

    The reason that arguments are passed in registers rather than on the stack where possible is the same reason that we generally store stuff in registers rather than in memory when we have enough free registers: Accessing registers is faster than accessing memory.
  3. In Topic: Is this use of pointer a bad practice?

    Posted 17 Apr 2014

    ptrName1 is not a "pointed-to object". You never take its address and you certainly don't store its address anywhere. So nothing points to it. Before line 9, ptrName1 and ptrName2 point to the same object. Afterwards they don't since you reassigned one of them. The fact that ptrName2 is const doesn't make it bad practice to reassign ptrName1. Those things have nothing to do with each other.
  4. In Topic: Calling classes within the main

    Posted 17 Apr 2014

    What does "calling a class" mean? Instantiating it? To instantiate a class in C++, you simply define a variable of that class like this: BlackJack blackjack;.

    Do note that the code you posted is actually Java, though.
  5. In Topic: const reference vs reference

    Posted 17 Apr 2014

    View Postinfernorthor, on 17 April 2014 - 11:33 PM, said:

    That is wrong syntax.


    What is wrong syntax? &r == &v? I assure you it's not.

My Information

Member Title:
D.I.C Lover
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Years Programming:
15
Programming Languages:
Haskell, Ruby, OCaml, SML, F#, Scala, Racket/Scheme, Vala, C#, C++, Java

Contact Information

E-mail:
Private
ICQ:
ICQ  205544826
Jabber:
Jabber  sexykane86@jabber.ccc.de