« first day (562 days earlier)      last day (4427 days later) » 

8:00 AM
I don't know if this is the right room but
is int a; a =5; an assignment or initialization
int a = 5 is obviously initialization but I am unsure about the above
 
user2334
@sabgenton int a; a = 5; is two separate statements: the first is a declaration, the second is an initialization.
 
@Mark ok so you don't call the second statment assignment?
assignment involves a destructor I understand
 
user2334
@sabgenton Depends on the language and who you're talking to, but I wouldn't call it an assignment because a hasn't been initialized yet. Assignment requires destroying the old value and replacing it with a new one
 
user2334
Some people define initialization as the first assignment though
 
yeah na forget them
:P
@MarkTrapp I thought it would be destroying an old value
say garbage
if it was in a function
(c/c++)
 
user2334
8:11 AM
In C/C++, as far as I understand both, assignment and initialization are two different things and that would definitely not be an assignment. In GC languages like Java or PHP or whatever, there's very little difference between the two.
 
GC?
 
user2334
garbage collected
 
ah see
didn't know php was GC :)
 
user2334
Yeah, using reference counting
 
@MarkTrapp thanks for the help :)
 
user2334
8:20 AM
de nada
 
user2334
@sabgenton Actually, looking around to confirm what I've been telling you, I don't know what I'm talking about. You might want to ask real experts who do instead, like in the C++ room.
 
yeah was looking my self
check this out
a constant can only be initialized
@MarkTrapp I don't have 20 reputation at stack :(
 
user2334
Ah I see
 
user2334
Well, it looks like it was asked and answered on Stack Overflow anyway:
 
user2334
2
Q: Initialisation and assignment

AppyWhat EXACTLY is the difference between INITIALIZATION and ASSIGNMENT ? PS : If possible please give examples in C and C++ , specifically . Actually , I was confused by these statements ... C++ provides another way of initializing member variables that allows us to initialize member variabl...

 
user2334
8:29 AM
This answer says it's assignment
 
ah great thanks!
@I didn't find it very conclusive
It's sounds like assignment could be initialization
if the var was previously garbage
@MarkTrapp maybe I will embarrassed my self and ask on stack overflow
 
 
8 hours later…
4:38 PM
hi
 

« first day (562 days earlier)      last day (4427 days later) »