It seems that you're using an outdated browser. Some things may not work as they should (or don't work at all).
We suggest you upgrade newer and better browser like: Chrome, Firefox, Internet Explorer or Opera

×
avatar
immi101: look closer :p

the memory for "buffer" is allocated via new. it is not occupying stack memory, but heap memory. Returning it would be totally fine in C/C++.
the C equivalent would be:

char *buffer = malloc( num_bytes );
avatar
dtgreene: But now we have a memory leak, unless the programmer remembers to put a call to free() after each call to the function.

(Putting free() inside the function won't work for a reason that should be obvious.)
Seasoned coders allocate the buffers they need, then tell the API functions how big they are and if they fit, let them fill them in, if they don't fit, they re-size them and try again.

On a similar vein, it's like the old COM days when you had to know when to call AddRef() vs. Release().

I think one of the still outstanding gripes about C++ (aside from its increasingly annoying syntactical changes) is its lack of a garbage collection facility.

To this day, I've never found anything better than Assembly language when it comes to communicating with a machine; however, adding a higher level language like C makes it easier to do logical and repetitive constructs.
Now some really tough nut.... I'm looking for a dev in the region Leipzig/Halle Germany with experience in ASP.NET MVC... Seems like able people are really scarce nowadays.
-
----------
Post edited July 24, 2016 by Tallima
Dear Server Manager,

Kindly fuck off.

Sincerely,
Everyone
Just feel like reviving this old topic which sadly died over a year ago.

Disappointed that the following Rust code does not compile:


fn main()
{
let の = 12;
println!("{}", の);
}
int i = 5;
i = ++i + ++i;

And this, ladies and gentlemen, is why C and C++ are both broken.
avatar
Personally, I prefer an example like the following:
if (x = 0) {
puts("stubbornly refusing to divide by 0");
} else {
printf("%f", 1.0 / x);
}

So, what is the output of this code if, say, x has the value 3?
Hey It folk. Remember remember the Javascript attacks of November? (or whatever month it was). How was that achieved? I'm trying to replicate it to test a program to make sure it's not susceptible to the same bug.
avatar
gooberking: If it were up to me I would just do HTML and CSS. Writing CSS and building responsive layouts is literally the only thing I care about or think I have any business doing. I don't see a lot of postings for that sort of thing.
avatar
real.geizterfahr: That's what I do for a living (plus a lot of SEO). I do understand a thing or two when it comes to PHP and Javascript, but that's just enough to see what a piece of code does (if it isn't too complex). But my main focus lays on HTML, CSS and responsive designs (= one stylesheet for everything between a 1080p screen and a tiny iPhone 1). It took a bit to get used to designs exclusively written with % and em, but it's great to see how different a website can look on different devices (without creating separate mobile versions or stupid apps).

If you're interested in responsive layouts, here's an awesome website about the power of CSS: http://www.csszengarden.com/
Every design on this site has the same HTML code! And all designs work on all kinds of devices. A great source of inspiration ;)
As an online business owner, investing in[url= https://ritedigi.com/seo-services/ SEO professional services ] SEO professional services [/url]can be a game-changer. It's a strategic investment that can yield long-term benefits and help businesses stand out from the competition. With the right SEO partner, businesses can unlock the full potential of their online presence and achieve tangible results in terms of visibility, traffic, and conversions. Don't underestimate the power of SEO in growing your online business - it's a must-have in today's digital world!
Can't reply to my own post, but for the record, the code snippet I wrote that didn't compile now does.

(On the other hand, the current browser I'm using to read that old message and write the new one isn't displaying that character properly, instead just displaying a box with the hex code.)
avatar
dtgreene: Can't reply to my own post, [...]
You can, but only manually.

avatar
HunchBluntley: You can, but only manually.
Post edited April 13, 2023 by HunchBluntley