« first day (698 days earlier)      last day (4249 days later) » 

12:00 AM
@JonathanSeng oops -- thinking about it, that was 2560x1920. My apologies.
 
Find in page doesn't find "recom" relative to resolution; neither does scanning the column. However, I know that most monitor makers are standardizing on 1920x1080 and not advancing the cause.
 
@MooingDuck I want one of those. Especially to see how slow it'll make Crysis run. Can't afford it. :(
 
The IBM T220 and T221 are LCD monitors with a native resolution of 3840×2400 pixels (WQUXGA) on a screen with a diagonal of 22.2 inches (564 mm). This works out as over 9.2 million pixels, with pixel density of 204 pixels per inch (80 dpcm, 0.1245 mm pixel pitch), much higher than ordinary computer monitors (which typically have about 100 pixels per inch) and approaching the resolution of print media. The display family was nicknamed "Big Bertha" in some trade journals. IBM T220 (9503-DG0) The IBM T220 was introduced in June 2001 and was the first monitor to native...
3840×2400 pixels! O_O
 
But, for me, that's ok. Higher res doesn't work better for reading text for me, so...
On another subject, I find teaching C++ and directly helping people a little more comfortable than jumping on questions coming in on SO. ;-)
 
@Insilico jeez
@Insilico "In order to support such a high resolution, it features an unusual connector arrangement. On the rear of the display are two LFH-60 connectors. A pair of cables supplied with the monitor attaches to the connectors and splits into two single-link DVI connectors each, for a total of four DVI channels"
 
12:04 AM
A 2560x2048 monitor turned vertically would be pretty awesome to code on.
 
I want one that can display my camera's output at full resolution (6048x4032), with at least a little room left over for Photoshop's toolbars and such.
 
@MooingDuck So you need like two graphics cards minimum to run the danm thing.
 
Make sure those two cards aren't on linux... Well, XOrg.
 
@Insilico Most video cards have 2 DVIs now.
 
hm, windows is low on virtual memory. That's not good
 
12:05 AM
@JerryCoffin Hah. Gimp 'strange' UI wins out again. I just put all that nonsense on another monitor
 
@MooingDuck download more ram
 
@Mysticial Yeah but the T220 monitors need 4 DVI links, no?
 
/me forgot about virtual memory when he bought the 16gb machine.
 
@Mysticial virtual memory.
 
@sehe Oh, I can do that with Ps as well -- I just don't want to have to.
 
12:06 AM
@MooingDuck It means, VS is almost fully loaded and ready to respond to your actions.
 
@sehe :(
 
@JerryCoffin wokay
 
@Insilico Wait, a single one of those monitors needs 4 DVIs?
 
@sehe time to remove virtual assist
@Mysticial yes
 
3 mins ago, by Mooing Duck
@Insilico "In order to support such a high resolution, it features an unusual connector arrangement. On the rear of the display are two LFH-60 connectors. A pair of cables supplied with the monitor attaches to the connectors and splits into two single-link DVI connectors each, for a total of four DVI channels"
 
12:06 AM
holy shit...
 
@MooingDuck Time To Leave Grand Hotel
Hey. I thought that was common idiom/meme. Turns out it is probably localized to 'Allemaal Projectie' (book by Gerrit-Jan Zwier). Who knew?!
 
Apparently the T220 monitor is a "Wide Quad Ultra Extended Graphics Array".
 
I'm running into severe overheating problems on my little box because of the two video cards I need for 4 monitors... And to need 4 for a single monitor - geez.
 
I don't know why, but I just feel like throwing out as a serious question, "Why on earth did Java have to omit the Destructor?" But then, I think, "Why did AS3 skip the destructor and, oh, just ignore the constructor too?" And then I want to find a non-technical book to read.
 
I don't know why "Wide Quad Ultra Extended Graphics Array" makes me laugh
 
12:09 AM
@Insilico Can imagine.
 
@Insilico Sounds about the same level as: "StackExchange™ MultiCollider SuperDropdown™"
 
Nice.
 
@Mysticial Should need only 2 for 4 DVI outs, really. I have never had >1 Graphics card and had two monitors attached since... I don't know how long
 
I can't imagine how they sync the 4 ports - especially across multiple cards.
 
@Insilico It just builds on CGA, EGA, VGA, (XGA?) EVGA, SVGA, UXGA, WUXGA --> WQUXGA :)
 
12:12 AM
Next computer I build, will need 4 video card slots so I can run 8 monitors. :)
 
What scared me earlier today I flipped out an answer to a question that had an "and if you can't do that...." case (which was fully tested) involving the typename operator and I haven't written any C++ in a year and a half. I have spent too long writing C++.
 
@Mysticial No, you should get 9 monitors so you can have a 3x3 wall of monitors.
 
@Mysticial Ooooh.... The possibilities -- though not in XOrg.
 
@Insilico damn... I'd need a way to get that 9th...
 
@JonathanSeng Why not? I'm on XOrg exclusively and can do whatever I please with my monitor setup, granted, haven't used multiple graphics cards yet
 
12:13 AM
Right now, my biggest machine can take 3 video cards - barely. And not at full bandwidth.
 
XOrg is architected around one monitor one card one screen. There are some hacks to make that better. But, beyond that to get one screen you need Xinerama which just fakes it. Try running a VMWare console in that and you're hosed.
 
I need one of those "truely" extreme overclocker boards that have like 8 pcie x16 slots.
 
@Mysticial Get three computers and network them together so that they work like one machine. :-P
 
You can do it and in some applications it works. But not well enough for me.
 
@Insilico Network lag...
I can feel that even over remote desktop.
 
12:15 AM
@Mysticial Okay, perhaps not over a network.
 
Universe Lag: That feeling that things should be and may be sometime later, but just not yet.
 
I get significant lag even over gigabit network.
Fuck fire alarm... brb...
 
Oh, and my brand new macbook pro has GCC 4.2.1 on it. How nice.
And the macports build throws linker errors when you use c++11 lamda functions with the -std option
 
@Insilico There is a software solution for that. And it works cross-platform, IIRC.
 
@JonathanSeng GCC is at version 4.5.4 now, I think.
 
12:19 AM
4.7.x.... Just not on my shiny new macbook pro.
Granted, I haven't upgraded the OS since that's reported to make video problems worse.
 
@JonathanSeng There's no Mac port for 4.7?
 
Quote: And the macports build throws linker errors when you use c++11 lamda functions with the -std option
 
Turns out Magic: The Gathering is Turing complete. I'm no longer impressed by template wankery.
 
@JonathanSeng So the port is actually a non-working one? How brilliant.
 
Well, it mostly works :-)
Indeed.
 
12:21 AM
@Mysticial Everything OK?!
13 mins ago, by Mysticial
I'm running into severe overheating problems on my little box because of the two video cards I need for 4 monitors... And to need 4 for a single monitor - geez.
^ I'm worried now
 
@sehe Mysticial said "fire alarm", not "fire", so perhaps the fire is somewhere else. (Or some asshole pulled a trigger off.) (Or it's a fire drill.)
 
@Insilico I know, right. It's why I ask
We have fire alarms. I routinely set them off while cooking. Signals the family that dinner's ready!
 
I'm still looking at how to report the bug.
 
I'm assuming it isn't GCC
 
12:24 AM
@Insilico It's an ongoing process.
@JonathanSeng Wrong. The first major work has been merged.
 
@sehe "2012-08-14: The branch has been merged into trunk. There is no code left in the branch for now. If major re-writes require the use of the branch, we will open it again."
 
@sehe yeah, quarterly drill
and I just got another annoymous downvote...
 
@Mysticial Ah. Good.
 
So save for bugs it's pretty much done, apparently.
 
I guess I'll delete that answer if I don't repcap today.
 
12:26 AM
@Mysticial Which one?
 
That's what makes social so anti-social.
 
"Rationale: Migrating GCC to C++ as implementation language:
•C++ is a standardized, well known, popular language.
•C++ is nearly a superset of C90 used in GCC.
•The C subset of C++ is just as efficient as C.
•C++ supports cleaner code in several significant cases.
•C++ makes it easier to write and enforce cleaner interfaces.
•C++ never requires uglier code.
•C++ is not a panacea but it is an improvement."
 
7
A: Cleanest way to copy a constant size array in c++11

MysticialThe C++ way would be to use std::copy(): float a[4] = {0,1,2,3}; float b[4]; std::copy(a,a + 4, b); That's about as clean as it gets.

Yes it's not the best answer. But I don't see how it's wrong.
 
@Insilico The branch. Not the rewrite. The basics have been done, I got the impression that was just footwork to enable gradual migration of the rest of the codebase
 
And I need to keep my rep a multiple of 5. :P
 
12:27 AM
@sehe Ah, I misread.
 
It's the second downvote on it. So there's definitely something wrong. Neither downvoter has spoken up.
 
@Mysticial Maybe because if I change the size of the array, the code is going to break?
 
You know, I think the std::begin answer is better, but that doesn't make yours bad. You gave useful info.
 
(since a+4 won't actually point to the end of the array if I change the array size).
 
Granted, I hate seeing the number 4.
 
12:29 AM
Not enough reason to downvote, IMO.
 
@Insilico That's been clarified in the comments. Though I wasn't sure if it's right to steal it from there.
 
Good, now I can upvote.
 
Suggested an edit http://stackoverflow.com/posts/12328330/revisions
Feel free to reject :)
 
@sehe it's fine
 
@Mysticial Of course you can incorporate info from the comments. I would cite it, however.
 
12:30 AM
@Insilico I'd downvote for it. But I'd leave a message saying so.
 
Too bad we can't downvote a down vote.
 
good evening everyone :)
 
@Mysticial I'm undecided whether I should upvote (which I'd say it now deserves) or downvote (so you can get back to a multiple of 5 more easily by just downvoting one answer).
 
I guess that's what I get for wandering into "real" C++ territory for once.
I wanna keep my downvotes at 3. Meh...
 
@Mysticial Come on in. The water's fine. Just watch out for the Crocodiles...
 
12:32 AM
I guess I need to answer some questions today to repcap.
This is an unusually slow week. So I'm not gonna get any free repcaps.
 
@Mysticial There you go. Fortunately, the "day" has just begun, so it should still be pretty easy.
 
And I have too much rep to suggest any edits...
dammit
 
And my day is over... Later guys.
 
night
 
@JonathanSeng G'night.
 
12:40 AM
I suppose I could invest in a few "reserve" downvotes that I can undo at any time to force my rep back into a multiple of 5 should it ever get away from it.
But that relies on the posts being edited after the downvote.
I love how I'm bitching about a downvote for all the wrong reasons.
 
I'm not saying anything
 
star me
 
why
 
So I can live in the sky with all the other astronauts?
 
It's not prime. Divisible by 5.
 
12:47 AM
MDCCCLXXI is not even an interesting year
 
MDCCCLXXI is an odd interesting year
 
@user1244215 the astronauts don't live there. And they don't travel in the sky, or they would be aeronauts.
O hey, a pedant. He might be a good fit here.
@user1244215 How's your day?
 
Much like any other. I'm trying to avoid enterprisey stuff
 
Good. You've come to the right place
 
You guys hate star trek too?
 
12:50 AM
I assume you know where your towel is?
@user1244215 Personally, I do. But I'm pretty sure I'm not representative in that respect
Hmm. This is a bit slow. I'll be back, but heading for bed anyways.
 
@user1244215 I'm not sure "hate" is really he right word, but I certainly don't subject myself to watching it.
 
1:20 AM
Oh well. I think we're dealing with a narcoleptic case here.
Night everyone
 
night
 
anyone care to help me on a small thing?
 
depends on how small
go for it
 
1:35 AM
The thing I learned is how bad beginners are at estimating how big an issue is.
 
jsfiddle.net/7wVKz I have this code. When I click the color, it changes the background. I was wondering if it was possible to fade in the color the user clicks instead of simply just changing it straight up. Perhaps fade in the new color? Would that be possible?
 
Damn it. Not even a C++ question. Part of me was hoping you were just using jsfiddle to paste it for some reason.
 
@user1079641 Um... this is a C++ room. We don't know anything about Javascript.
@Rapptz Nah... it's JS... at least that's what it looks like.
 
@Mysticial Yeah, I know.
@user1079641 You can do that with CSS.
 
@user1079641 I used to know stuff about JS, back when I was a Web developer. It's all mostly forgotten now, but I guess you can use jQuery for that.
 
1:40 AM
Yeah, jQuery is really great. It does everything.
 
@user1079641 $('#myElement').animate({backgroundColor: '#FF0000'}, 'slow');
I found it on SO, I don't use jQuery.
 
But how do you put "document.body.style.backgroundColor = $(this).children("span").css("background-color");" into "$('#myElement').animate({backgroundColor: '#FF0000'}, 'slow');" ??
 
22
Q: How do you fade in/out a background color using jquery?

mrblahYou know how some sites fade in /out color on a error message, how can you dothat with jquery? The point is to draw attention to the user about the message.

 
@user1079641 What part of "We don't know anything about Javascript" do you not understand?
 
Googling does wonders, I know.
Anyway fuck javascript. I used to use it as a scripting language for fun and I regret it.
 
1:44 AM
@user1079641 What made you come here in the first place? You're already in the Javascript room.
 
I came here before anyone responded there, now they are responding, but you guys replied to my question so that is why I posted back. I understand that you can't help me since you are not sure on javascript stuff, I just thought you might be able to help in case you know. I am sorry for any inconvenience that might have caused.
 
@user1079641 Yes. Our reply was "We don't know anything about Javascript". :-P
 
How do I make a header-only library?
Do I just... inline everything?
 
@Rapptz Yeah... pretty much.
 
@user1079641 Well, we're good at Googling, but that's about it.
@Rapptz You put everything in header files.
 
1:47 AM
Either you inline everything, and/or make everything static.
 
Asking Javascript questions in a C++ room is like walking into a lounge in the English department at a university asking the people there for help with your vector calculus homework.
@Rapptz What makes you think you need a header-only library in the first place?
Is your entire library made up of templates?
 
I often go header only if the code is really simple and I don't wanna mess with linking.
 
Can anyone give me your thoughts on this website khanacademy.org
 
@MohamedAhmedNabil It's a good site if you learn best via video.
 
Because I don't want to go through the process of linking everything in case I ever do distribute this. I also don't consider this library big enough to expand upon it with multiple files.
Sal's a pretty cool guy.
 
1:50 AM
I personally hate videos for learning anything, but that's my personal preference and not a failing of Khan Academy, of course.
 
@Insilico If you check the computer science part. Has videos on theorems, algorithms, cryptography, game design etc...
 
The CS section was redesigned recently.
 
@MohamedAhmedNabil Oh I haven't seen them.
 
@Insilico Videos arent the best way to learn, books have alot of more info. But understanding easier
@Insilico khanacademy.org/cs check the left side bar
 
@MohamedAhmedNabil For me it's way easier to understand something if I read it rather than watching it. But again, that's just me.
 
1:54 AM
@MohamedAhmedNabil Subjective.. Others learn well through videos others don't. Your experience doesn't make up everyone else's experience.
 
@Insilico I agree, but i mean just the introduction to something... It will be a bit more encouraging if you start with a person
 
@Rapptz What part of "For me ... But again, that's just me" do you not understand?
 
@Insilico Not you. Mohammed.
2 mins ago, by Mohamed Ahmed Nabil
@Insilico Videos arent the best way to learn, books have alot of more info. But understanding easier
 
@Rapptz Ah okay. Got lost in the different threads of conversation again.
 
My fault for not replying properly.
 
1:57 AM
@MohamedAhmedNabil I find videos incredibly annoying because of how slow paced they are.
 
@Rapptz I actually typed enter without completing my sentence, my bad
 
Kudos for Sal for making an extensive resource, though. I can't comment on the quality though, since I don't watch them.
 
The videos on KhanAcademy are really well done, imo. The pace isn't too slow or too fast.
 
@EtiennedeMartel They're always a little the wrong pace. Usually way too slow, then when they hit a hard part, they don't slow down for a second to let you think, and by the time you've caught that, you may have missed something else, so you wind it back (and usually find you didn't really miss anything important, so you just got to watch annoying, slow-paced nonsense twice).
 
The iPhone 5, a fail or not?
 
2:04 AM
@MohamedAhmedNabil Is it from Apple, or not?
 
I liked the Nokia Lumia 920. Actually showed innovation rather than staying with the same concept for the past 6 years.
 
@Rapptz Some of its features were Photoshopped in, though.
(i.e. trailers were not really accurate)
 
@Rapptz I was looking forward to the new design and all they do is make the phone 3/4 matte finished
 
They released an apology video though with accurate representation of it.
@MohamedAhmedNabil I didn't have high expectations for it because Apple.
 
Oh, you. Apple always makes decent, albeit overpriced, products.
 
2:06 AM
epic :D
 
@EtiennedeMartel I liked my iPhone 4. The iOS5 upgrade fucked everything with alternative iPod managers so I'm stuck with shitty iTunes so I dislike it now.
 
@Rapptz Just wait for the developers of said alternative managers to re-reverse-engineer the protocol. :-P
 
@Insilico It's been months. Most are only read-only unfortunately.
and now they're moving on to iOS6.. in 5 days.
 
What's the latest fully jailbroken OS?
 
Okay, "The Gates of Delirium", by Yes, is an amazing song.
 
2:12 AM
Do any of the later OS's have free teathering?
 
@Mysticial Yes.
 
@Rapptz Oh? Which?
Then I won't have to bother with my half-jailbroken phone and trying to crack the WiFi program from Cydia.
 
@Mysticial Most of them? I know Absinthe does it and they're up to 5.1.1
 
How do you check the iOS version? I can't seem to find it.
 
Settings > General > About
 
2:16 AM
Version 4.28 (8E401)
I've been afraid to upgrade it since it'll probably break my current teathering app (which no longer works anyways)...
When I get the time, I need to look in again at the iPhone stuff. Hopefully get free teathering working.
It sucks to layover at an airport for hours without internet other than on my phone.
 
I actually haven't jailbroken my phone in a while.
I'm running clean 5.0
@Mysticial I just realised you meant if the non-jailbroken iOS can do free tethering. It can't.
 
dammit
 
Absinthe is a jailbreak
My service provider (AT&T) charges us for tethering so it's obvious it won't be free lol.
 
@Rapptz What's preventing someone from installing an "alternative browser" that actually just forwards the data to a laptop?
 
I'm.. not sure what you mean sorry.
 
2:24 AM
These companies use a whole bunch of technical countermeasures to prevent free tethering, but what if I made a "browser" that's just a proxy for my laptop?
 
@Insilico I think you need to jailbreak it to get arbitrary programs to run.
 
@Mysticial Okay, what about phones that allow arbitrary programs without approval (e.g. Android's sideloader)?
 
@Insilico On Android tethering is free.
 
I wasn't able to get free teathering to work because I didn't "jailbreak it enough" to be able to SSH into the phone and overwrite the teathering app with the cracked one.
 
@Rapptz Oh, okay.
Honestly I hate that one has to go through lots of hoops to install whatever program they want.
 
2:28 AM
yes it's stupid.
Too much money to be made.
 
I hope Windows Phone 8 isn't lame =/
Not sure if I want to make the switch from iPhone to Lumia
 
@Rapptz I hear the Windows Phones lately are actually pretty good.
 
Good thing is I can probably develop for it in C#/C++ if I want to as long as there isn't a catch.
 
@Rapptz It says a lot about the industry when we have to worry about "catches" like that. :-/
 
I meant that because that looks pretty neat.
 
2:41 AM
What in the world is Jon Skeet doing up at this time...
 
2:51 AM
here char* argv[] this is an array of char pointerS?
 
@MohamedAhmedNabil Yes.
 
@Insilico My book said they are read only but i easily edited them
int main(int argc, char* argv[]){
	cout<< argv[0]<<endl;

	argv[0]="Hello";
	cout<<argv[0]<<endl;
	cin.get();
	return 0;
}
maybe the book means what they are pointing to?
 
@MohamedAhmedNabil What book?
 
argv[0] is always the same of your program.. well supposed to be.
 
@Insilico C++ without fear
 
3:08 AM
Just watched a ShayCarl video for the first time in like 2 years. Holy shit.
 
Anyone make any sense of this comment?
@Mysticial rand() returns a values that is in the user input range, doesn't create the mix between a faked entropy and a predictible behaviour, if you input 0 and 100 you get something between 0-100 and this is not a precise and predictible behaviour to me. — hthy46vbs 1 min ago
 
"rand() returns a values that is in the user input range"
 
Well.. it's incorrect.
 
I'm pretty sure that's not how rand() works.
I guess hthy46vbs wants a pseudo-random number generator?
 
Why can't he use the <random> header? It probably does what he wants to do much better than he could possibly implement it.
 
3:19 AM
i cant change the value stored in char arrays without strcpy?
Let me rephrase it. I cant change the value stored in char arrays with assignment operator?
 
@MohamedAhmedNabil Shittiest example I can come up with. ideone.com/PR2Qx
I don't like C-style strings.
 
@Rapptz these are char pointers, i was talking about char arrays
 
@MohamedAhmedNabil ideone.com/bJWRn
 
@Rapptz but not directly a="aaaa";
 
Why would you do that?
That causes buffer problems.
 
3:26 AM
I believe you can modify argv according to the C standard. Not sure about C++.
 
@Insilico I moved past argv. argv points to a string literal which is a const. but i can change what argv is pointing to
 
@MohamedAhmedNabil Of course. You can always modify the values passed to you via the parameters.
(Unless it was declared const, which is pointless)
The parameters passed to you in a function call are local to you.
 
@Insilico argv[] is a bunch of pointers. Each one points to a string literal in the memory. What is pointed to is a const but the pointer itself can be changed to point to other stuff
 
@MohamedAhmedNabil Yes. I just said you can modify the values passed to you via the parameters. What was passed to you are pointers to string literals. You can modify the pointers.
And according to the C99 standard you can modify the pointed strings as well. I don't know about C++, though.
 
@Insilico in C++ string literals are consts, pretty certain of that
 
3:34 AM
@MohamedAhmedNabil Yes they are, but I don't see anywhere in the standard that says argv is an array of char pointers to string literals.
 
@Insilico Logic says so
 
@MohamedAhmedNabil Logic says what?
 
@Insilico The arguments are chars and are stored in the memory, same as string literals
 
@MohamedAhmedNabil Yes, but the fact that the strings are in memory implies nothing about their constness.
 
@Insilico should anything stored in the memory not as a variable be considered a const?
 
3:37 AM
@MohamedAhmedNabil No.
constness is a property of C++ data types, not of what's in your computer's memory. The processor knows nothing about const data.
 
@Insilico Check this out :
int main(int argc, char* argv[]){
	*argv[0]='a';

	cout<<argv[0];
	cin.get();
	return 0;
}
it worked :D
 
You replaced the first letter with an a
I'm not entirely sure what you wanted to do.
 
@Rapptz if it was a const it wouldnt change right?
 
Who said it was a const?
const isn't a property that exists in C so why would it exists for the C++ standard of argv
 
@Rapptz I did, arrogantly
 
3:40 AM
Also @Insilico I'm pretty sure from what I've read that the C and C++ argv are the same.
 
@Rapptz Actually, it does.
 
@Rapptz I thought that since string literals are const then this would be too
 
@EtiennedeMartel TIL
 
Although const doesn't have the same semantics in C and in C++, it does exist in both.
 
@MohamedAhmedNabil argv != string literal.
 
3:41 AM
@MohamedAhmedNabil You misunderstand what a litteral is.
 
@Insilico but argv is a pointer to a char array right?
 
it can also be written as char** argv
 
@MohamedAhmedNabil No, it is an array of char pointers.
 
@Insilico i mean each element in it is a pointer to a char array
 
So what does const do in C?
 
3:42 AM
@MohamedAhmedNabil Yes.
 
@Rapptz Makes a variable unmodifiable.
 
@Rapptz It's used mostly on constants and pointers.
 
@Insilico This means that argv elements point to char arrays that arent string literals?
 
@MohamedAhmedNabil What makes you think that char pointers have to point to string literals?
 
@MohamedAhmedNabil A string litteral is a string that is written in the source code, between quotes ("").
 
3:44 AM
char buffer[1000]; char* p = buffer;
 
@Insilico i dont know
 
@Insilico No need for that &.
 
@EtiennedeMartel so there can be a char array in the memory that isnt a string literal?
 
@EtiennedeMartel Thank you.
 
@MohamedAhmedNabil Yeah, you can allocate one yourself if you want.
 
3:45 AM
@MohamedAhmedNabil A string literal is just a sequence of characters that appears in source code.
 
@MohamedAhmedNabil ideone.com/bJWRn
 
Your RAM doesn't know the difference between a string allocated via a string literal or one allocated through some other means.
 
Crappy(?) example again
 
@Insilico Well, litterals might get in read only memory, so it depends on the OS.
 
a literal was written into the source code and is compiled was compiled as a constant.
 
3:46 AM
@EtiennedeMartel Sure, but that sort of protection is enforced through the OS's virtual memory mechanism.
 
@Insilico Indeed.
 
The compiler (but not the runtime) will not let you alter it.
 
Another example: char foo = 'a'; char* p = &foo;
The char pointer p doesn't even point to an array of characters.
 
Once in ram, its like any other char* value -- a block of memory that means something to you and I.
 
I can't say I've been on porn tube sites to experience the amazing banner loading times, but I can't imagine there's anything special involved. Just use highly compressed video. — minitech 1 hour ago
 
3:48 AM
Any ads with videos/sounds = automatic adblock
 
@Mysticial Hey, it's that minitech guy.
 
@Insilico this will cause problems
 
@MohamedAhmedNabil How so?
 
@MohamedAhmedNabil Like?
 
3:50 AM
@Insilico if i do this cout <<p;
 
Correct.
a single char is not a null terminated string.
const char * literal = "abc";
 
Yes, if you cout << p; using the p in my previous example, things will not work.
 
const char * wasALiteral = literal;
 
That's why we tell people to use std::string, because C-style strings suck.
 
@JonathanSeng yep, i will need to dreffrence
 
3:51 AM
In the compiled code, both literal and wasALiteral will point to an array in the loaded object code.
const char * newString = new char[32]; newString[0]= '\0';
This will be allocated at run time and is NOT a literal.
strcpy(newString, literal);
This COPIES the values in literal to the non-literal, dynamically allocated newString.
No, Mohammed. The problem with p is that it was just a char.
 
@JonathanSeng p is a pointer to a single char, not the char itself. You might want to change that. :-)
 
A c-style null terminated string exists in ram within an array of chars such that immediately after the last intentionally used character is the numeric value of 0.
p was a pointer to foo
However, on the stack we had:
...
single char foo with value a
 
@JonathanSeng correct me if im wrong, but isnt sending a char address with the stream operator, sends it untill it finds a null?
 
pointer p with value address of a.
If you use p as a string, it will take character 'a' and then look at p as if it were part of the string.
Correct mohamed.
The problem was that foo was a single char.
Not a character array with a null character byte.
Now, in practice, that example would likely work.
Since the compiler likely padded the stack frame as:
char foo, char unused, char unused, char unused, char pointer p....
and the unused would have been initialized as null.
But, that is very much and assumption and things would likely go very bad.
char foo = 'a'; char* p = &foo;
char * bar = "a"; char * q = &bar;
 

« first day (698 days earlier)      last day (4249 days later) »