Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 09 Jun 2000
Offline Last Active Today, 05:15 AM

#5305806 Pre-emptive Solution for 'The application was unable to start correctly (...

Posted by on 14 August 2016 - 04:28 PM

I am linking the static OpenSSL libraries so shouldn't I not need to distribute the dll with my installer? Shouldnt it be packaged into the exe?


My Linker->Input->Additional Dependencies are:










Bear in mind that libraries with a "d" at the end are generally debug libraries, and you probably don't want them being used in the release version of your code. 

#5303860 Xml Parser, C++

Posted by on 03 August 2016 - 03:37 PM


 Advantages of TinyXML-2
Many fewer memory allocation (1/10th to 1/100th), uses less memory (about 40% of TinyXML-1), and faster (~5x on read).



I tried TinyXML-2 and it's still a memory hog. The conversion from TinyXML was very easy.


TinyXML is a DOM based parser. This means it has to load the entire document into memory first. For a lot of applications, that's fine (desirable even).


If memory is an issue, you could look at a SAX based parser, which uses an event-driven model to process the XML. This uses less memory, but it isn't as easy to program with (in general, YMMV).


For C++ sax parsers, you can use Xerces or Libxml++ (there may be others, those are the two I have used).

#5303575 Xml Parser, C++

Posted by on 01 August 2016 - 08:02 PM

One problem that I have with TinyXML is that it takes up 1.6+ GB of RAM to parse a 346MB XML file.

Might be worth looking at TinyXML2 then?

Advantages of TinyXML-2
Many fewer memory allocation (1/10th to 1/100th), uses less memory (about 40% of TinyXML-1), and faster (~5x on read).

#5303559 Xml Parser, C++

Posted by on 01 August 2016 - 04:29 PM

I've even written a C# wrapper for CMarkup, and use it in a number of .NET projects.

What advantages does CMarkup have over the .Net XML libraries? 

#5303040 Xml Parser, C++

Posted by on 28 July 2016 - 10:24 PM

What have you used to parse XML files in C++?

Exactly what do you want to do with these parsed XML files? 


If you just want to read the XML into a data structure, TinyXML is simple and lightweight.


But it doesn't do schema validation or XSL transforms.


Libxml and Xerces will (I think, been a while since I used  them), but it's not as easy to use. 

#5301299 A Struct That Contains A Delegate With Unknown Signature

Posted by on 18 July 2016 - 09:40 PM

Stop and think about what you want to achieve. 
So you want to have commands that invoke delegates that potentially take arguments and return some values.
Where are you going to get the argument values from?
What are you going to do with the return values? 
IF you can explain what you want to achieve better, than we might be able to help you.

#5300081 Finding that balance between optimization and legibility.

Posted by on 10 July 2016 - 10:54 PM

I have the luxury and flexibility to do what I want and try to challenge conventional thinking. In so doing I've discovered pros and cons for going against the norm as well, and i will take the route of least resistance (wether it is a conventional approach, or something to the contrary).

Nothing wrong with that. Just be aware that there are often very good reasons for conventions. They frequently encode a lot of lessons learned the hard way.
By all means, challenge them, but do so understanding why they are conventions in the first place.

For me personally (and in my own subjectivity), I've found working within the confines of the C++ and OOP in general to be quite problematic.

And on the flip side to what I just said... no-one is forcing you to write C++ in an OOP manner. 


If you're writing something and you think it should be a free function/struct/other "non OO" construct, write it as such. 

It is one of the strengths of the language that it doesn't force you into OOP, unlike Java or C#. (I love C#, but I find it stupid that I have to create a static class to write a simple function).


#5297374 what means these error?

Posted by on 20 June 2016 - 03:40 PM

What does your debugger tell you? Not the output, the actual debugger. Step through the program until you get to the line that is causing the problem.

Look at your data. 

#5296765 CrossPlatform Code

Posted by on 15 June 2016 - 10:02 PM

I would go for roughly the second option - define a common interface in a header file, but instead of having #ifdefs sprinkled throughout the implementation, consider having separate .cpp files for each platform. So you might have memory.h, memory_win32.cpp, memory_linux.cpp, memory_x360.cpp, etc. Your compiler toolchain(s) should allow you to make some files compile in some configurations but not in others.

This. and possibly also a memory_common.cpp for platform-agnostic code.

#5296622 How to avoid Singletons/global variables

Posted by on 15 June 2016 - 06:16 AM

...it's use case is obviously for data that needs to be globally accessed, but is NOT expected to mutate much at runtime.

That is NOT what a Singleton is. The Singleton pattern is about insuring there is only ONE instance of an object in a given code space (project/application/library/whatever).

That's it. The pattern has NOTHING to do with global access or mutability of state.

The problem is that idiot programmers see a singleton and think "oh, this is the OO way of doing globals", when that's not the intent of the pattern at all.

Global mutable state is bad (the reasons should be pretty obvious by now).

But singletons are bad in a completely orthogonal way, because they enforce a completely unnecessary restriction. If you only want one object, just create one bloody object!

If you need a global object (mutable or otherwise), first ask yourself if you REALLY need a global object. If you're satisfied that you do, then take responsibility for that decision and don't pretend it's somehow better because it's a singleton.

At least then in the future, when you realise that thing that you knew there would only be one of turns out to require more than one of, you haven't shot yourself in the foot.

#5295889 Do you usually prefix your classes with the letter 'C' or something e...

Posted by on 09 June 2016 - 05:46 PM

 i'm interested why microsoft in MFC uses C prefix, if it not correct for CPP?

MFC is a not a good example to follow when writing C++. 


Aside from the actual design of the library, the coding conventions used are mostly considered bad style these days.

#5295754 Do you usually prefix your classes with the letter 'C' or something e...

Posted by on 09 June 2016 - 04:27 AM

justify why minus in reputation?

Because every time you whinge about your reputation, you get downvoted. It's practically tradition.  :P 

Lowercase, in some cases make code unreadeable

Once again, you need to learn the difference between your subjective opinion and an objective fact.

in C# uppercase letter is part of official code style

Yes, in C# uppercase is part of the language coding conventions, but this thread is about C++, not C#.

#5295526 Getting a Job As A C++ Programmer With Web Dev Experience

Posted by on 07 June 2016 - 03:10 PM

Interesting, can't say I've ever worked at that level, most people I've worked with is 10. Half of them were UI/UE designers.

That's ok. Most people don't work on that kind of project. It's typically for a really large desktop or enterprise application.
Most software is written at an SME level.

To answer your question, I suppose it's simply something I'm most comfortable at of doing and knowing low level of things. i.e I would much rather build the server software that runs the website and dealing with worker threads, logging, and learning the HTTP protocol extensively then actually putting together the PHP and HTML that shows up.

Those kinds of jobs are relatively rare. To take your specific example, you're talking about writing a web server. There are basically only a few web servers that people use: Apache, nginx and IIS are most of the market. It's not easy to get a job working on them.

Of course, if you mean writing web applications that run on a server then....

I'm definitely noticing that where I live with all the .NET positions cropping up. Perhaps I'm stubborn, and should just pick up a few books on .NET and deal with the current market to adapt. Not to start any flame wars, or no offense to any die hard fans, I just found .NET a very limited platform, which is why I don't bother with it and I do see why companies use it. Something breaks then there is someone else to yell at. ;)

 .Net is actually a really good platform for the kinds of work you describe, and C# is a very nice language that's getting better with every version (IMO).

In all honesty, I'm looking for something rewarding in the long run. (health insurance, retirement, salary). Just something a little more stable, where I work I get no benefits, just pay by the hour. Got a few people telling me they get 40k a year and work 50-60 odd hours a week in the game dev world, seems a lot of stress for nothing.

Then stick with web programming. Try to get onto bigger teams. In a few years, see if you can lead the team, maybe even manage the project. Eventually, ditch coding altogether and move into management. If you want rewards and stability, that is the way to go.

Hate to say it, but I'm kinda leaning towards the self start up idea of opening a online marketing business that will evolve into other areas. Definitely will need a bit of time and money, before that can get rolling. Of course one thing at a time. ;) You can't be a "astronaut, doctor, and president at the same time".

As long as you're aware that you're getting into one of the most cut-throat, competitive industries out there. Online marketing, SEO, etc is a dog-eat-dog world.

If you can succeed at it, more power to you, but if stability matters to you, stay away from it.

#5295362 Getting a Job As A C++ Programmer With Web Dev Experience

Posted by on 06 June 2016 - 03:18 PM

Your distinction between developer and engineer doesn't really exist in the real world. What you're describing is basically the difference between junior and senior positions. 

There's no industry standard, but titles are generally along the lines of

  • junior developer: simple tasks, minimal decision making. Basically, you're there to learn.
  • developer: more complex tasks, some decision making. 
  • senior developer: most complex tasks, some high-level design work
  • technical lead: responsible for the technical direction of the project, chooses technologies (frameworks, engines, etc) for the rest of the devs.
  • architect: doesn't do much (if any) programming. purely responsible for the high level design of the project.

Those are VERY broad strokes and highly dependent on the size and nature of the company and the project you're working on. A small project might have one person covering all of those roles, whereas a massive project will have teams of people at each level for various components/subsystems.


Anyway, why do you want to be a C++ programmer? Do you have a specific end goal in mind (e.g. games, high-performance computing, etc)?


Most positions these days are more focused on the mobile or web space and the most common languages are java, c# and javascript.


This might be kind of a big question, but have a think about what you want out of your career (and by extension, your life). In terms of money, you can do just as well (probably better) as a competent web developer. If you want to do game dev, then C++ is pretty much required for the big AAA studios, but understand that it often comes with less pay for more hours.

#5295262 Do you usually prefix your classes with the letter 'C' or something e...

Posted by on 06 June 2016 - 06:45 AM

Hey All.
I used to Put C for class, reason was so I could use the actual name of the class as the variable name.
Like CActor Actor; //works for me

as opposed to Actor actor?