Visual Studio C++ IDE settings

Or makefiles to anyone else…

This is just to make sure I can reproduce the exact builds when using Visual Studio’s IDE. The settings tend to be in dialogue boxes that require manual changes. These instructions show where to find the key changes.

Two main sections. There is the IDE settings themselves and also the projects Configuration Properties. Note that debugging is in with the IDE and not with the compiler configuration.

Further down will be a discussion on how to update Visual Studio directly via its XML files.

Continue reading “Visual Studio C++ IDE settings”

C++ Coding Standards

The following is not intended to generate a holy war, but merely a place for me to remind myself of the decisions I took along the way to get to a consistent style for any new code that I write.

#pragma warning( push, 3 )
#include <stdio.h>
#pragma warning( pop )

// /Wall Used. Compiler warnings turned off.
#pragma warning (disable :  5045) // Spectre code insertion warning.

class entity
{
    static constexpr size_t     _maxEntities = 1000;
    entity(char* name)
    {
        _name = name;
    };
    void set()
    char    _name[8];
};

inline float _floor(const float& a)
{
    if (a == 0.0f) return 0.0f;
    return floorf(a);
}
Continue reading “C++ Coding Standards”

C Strings in C++ and Deep Copies

I was told on Stack Overflow:

“A pointer is just a pointer.”

And that is true of course. To go beyond that we have structures and classes which have explicit construction and operators. However, C++ has inherited C strings which are just a pointer to the first char, but they also have a long history where the construction and operations are well known. So, when a C String is given to a map or vector, it may be thought that it could be doing a deep copy. After all, it is known (by implicit rules) how this could be completed. The size is defined. It is just not stored. Also, the storage is clear – just not managed.

Continue reading “C Strings in C++ and Deep Copies”

Buying a New Keyboard – The Mechanical Renascence

So you have an old Microsoft Wireless Desktop 3000 Keyboard and Mouse. You get used to it and it becomes your ‘personal standard’ for keyboards. It has full travel keypress and all the keys laid out the way you want them – the large Enter Key and the Media Mute key. But then it gets old and breaks and they don’t make that version anymore, so you look for the closest replacement. In this case the cheaper Microsoft Wireless Keyboard 2000. It’s OK and you put up with it, but the mouse starts to break as well. What to do…

Microsoft Wireless Desktop 3000 Reviews | TechSpot
Microsoft Wireless Desktop 3000 Keyboard (with the full size UK Enter Key)
Continue reading “Buying a New Keyboard – The Mechanical Renascence”

Learning C++

This is a series of things that I found out when learning C++. The approach is going to be non-standard and likely to annoy any normal C++ professional. I am interested in languages in general and so I will be doing all my early code without STL at all. I want to learn what features the language offers before starting to use the standard libraries. To this end I try to do do simple version of the features that are already available. That way I can see how these features are implemented in the standard libraries. To me, that feels like a important advantage in learning a language. I did try to read the code for the libraries but it has a lot of very nuanced additions that I will only get to understand much later on. The code is still interesting to step through however as it does offer clues as to how to unpick various implementations.

Continue reading “Learning C++”

Asking Stack Overflow the best way to do Template Specialisation

In learning C++ I dug in and tried to use classes and templates to solve what feels like a typical use case. I found that what I needed was Template Specialisation and that C++ does not support this very well. I came up with 3 different methods and wanted to check what others though was we the best approach. If there was a “preferred idiom in C++”, or an even better solution.

Continue reading “Asking Stack Overflow the best way to do Template Specialisation”

Streaming a Window Without Hardware

Given what OBS does (screen grab and encode) it would seem that there should be a simple way to capture a window and create a local video stream from it. This could then be viewed remotely served from your home PC, or used as an input in the composition for a stream scene.

This is clearly done using a HW video capture device, but that is expensive and given everything is already digital, seems like an odd detour.

An example use case for this is if you were using a separate Windows laptop of tablet for drawing and wanted to be able include it in a Twitch stream. Web cameras do this and use the RTSP protocol. So I went looking for a simple way to set this up on a new machine.

Continue reading “Streaming a Window Without Hardware”