Let's say I studied with ++. However, these are just console applications, classes, references, pointers, work with files, etc.

How to write a driver? (which way to look, whether there are books or documentation). What generally should be written in c ++ and "how, what"? Which API is better to use for writing window applications and is it worth doing it with C ++?

So I can not understand how this happens, because in books with ++ this is not. I hope you understand the course of my thoughts and can clarify. Thank.

Closed due to the fact that it is necessary to reformulate the question so that it was possible to give an objectively correct answer by the participants of Kromster , AK , entithat , pavel , iksuy 12 Nov '18 at 12:39 .

The question gives rise to endless debates and discussions based not on knowledge, but on opinions. To get an answer, rephrase your question so that it can be given an unambiguously correct answer, or delete the question altogether. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • one
    full of books, Google to help - MDJHD

4 answers 4

In my opinion, one of the most pressing problems of modern literature is a lot of fundamental and a little more professional. I will try to explain it the way I see myself. Although I do not have much knowledge, but at least I will try. I hope knowledgeable people will correct, if you made a mistake.

So, the work of electronics is mediocre data transmission on tires from one control device to another (processors, microprocessors, microcontrollers, etc.). Depending on what data is transmitted, the electronics perform certain tasks. In fact, this is the level of computer architecture and assembler, which would be very good to know at a basic level (Tonenbaum - "Computer Architecture"). These commands are usually combined into a kind of blocks, similar to functions that make some specific goal. Sometimes heaps of functions are created that are combined into function libraries (the same math, iostream, etc.).

Low level driver:

To write a driver, you need to send these same commands to control devices. C ++ language is not very suitable for these tasks, it is easier to use pure C. In the simplest case, some library is connected that allows you to send values ​​to devices and read them. For example, the simplest way to access the dynamics of a PC may look like this (note, windows does not allow direct access to ports!):

#include <conio.h> main( ) { int store; store = inp (97); /* запоминание начального значения с помощью порта 97 */ printf("пopт 97 = %d \n", store); /* проверка результатов*/ outp(97, 79); /* посылает 79 в порт 97; включение громкоговорителя */ outp(97, store); /* восстановление начального значения */ } 

True good people usually make third-party third-party libraries that already contain a list of ready-made functions, classes, structures for accessing devices. For example, the code above works fine from the windows.h function library, calling the function beep (). If you want to write drivers, you will have to read about how to access the device from the developer documentation from official websites, what commands the device can execute, what data you need to send for this, if there are special libraries for this from developers and much more.

High level.

People who use C ++, usually work with ready-made sets of libraries or create their own for certain tasks. For example, there is such a thing as WinAPI for creating Windows windows GUI. These are again ready functions, you connect library and work with them. In response, they do some work and give the result. If you look at the minimum window, then in the code you will see the filling of familiar elements: structures, function calls, use of loops, etc. Another thing is that these functions and structures were done by the developers and they perform certain work, you just have to call them. For acquaintance with them there is a documentation.

Higher and higher.

Usually, libraries are made universal and can be reused. For example, on the basis of one you can create another which will perform even more specialized functions. For example, you can create a library with a line drawing function. From it is a library with the function of drawing geometric shapes. From her library with drawing details, etc. This is how functionality is increased. There are, for example, software drawing graphics on the monitor, in windows its winAPI add-on (lines, windows, colors are already ready), but it also has a higher-level MFC or Windows Forms shell, which are more advanced, but based on WinAPI.

As a result: in fact, the job of a programmer is to find out which library can help to cope with the necessary tasks and study it. And having studied apply to their needs. Do you want to use a Windows GUI application - there is a WPF and a Windows Form, or at a lower level take WinApi. Want to use a graphics card for 3D applications - learn DirectX. Want to work with music, again, all libraries like OpenAL are available. Hunting to write drivers, look for information on how you can access devices and through which library. Want to find out why ready-made libraries are used, study computer architecture and the very basics of assembler. In any case, you will use the main learned elements of the C ++ language: structures, functions, classes, pointers, simple data types, etc.

PS While I was writing, I had already begun to doubt the correctness of what was written)) I also advise you to look at this site here: http://www.firststeps.ru/

  • one
    @avp They say that VB is best suited for writing drivers. - alexlz
  • one
    >> but what exactly of the C ++ tools, which are radically different from those used in C, is necessary when writing drivers: All but exceptions. If you do not agree, then my question is to you: what exactly from C tools that are radically different from those used in MASM is needed when writing drivers? - nitrocaster
  • 2
    @Flammable, but in general, nothing. C is, after all, just a macro assembler with types (in every joke there is some joke). What is good. But the crosses are a monster that in inept hands gives rise to terrible programs. - avp
  • one
    @Flammable from Hegel was such a thing - the dialectic. And it was the law of the transition from quantity to quality. And a few thousand (and even tens of thousands) lines in assembler are much worse read than a few hundred lines in C. - alexlz
  • one
    @avp, >> But the crosses are a monster that in inept hands gives rise to terrible programs. So if inept hands, then you should not take up the development of drivers. Any text is a valid C program - familiar joke? This means that crooked hands will cause disasters because of language. @alexlz, and now replace the words "assembler" and "C" with "C" and "C ++", respectively. - nitrocaster

as Alexey123 C \ C ++ correctly noted, quite a lot of where it is used and the amount of knowledge and practical skills can be completely different ...

of the general mandatory for any programmer is:

desirable for most programmers (know the basics well)

  1. be able to read C / C ++ (simple simple examples)
  2. know how the C / C ++ program is going
  3. understand how the processor and memory work

mandatory for all programmers, I personally think that it is better to master it using the C ++ example, since there you can compare the functional and OOP styles and at the same time compare them in speed.

  1. know and be able to calculate Big O notation
  2. know data structures: array, vector, list, queues, trees (binary, suffix, AVL, RB)
  3. know what templates are
  4. know containers (implementations of the above-mentioned data structures)

higher level

  1. know OOP and design patterns
  2. IDE + debuggers
  3. version control systems
  4. parsers
  5. profilers

as for the GUI in conjunction with C ++, you need to stay away from C ++ Builder (it is extremely annoying when you are kicked out of the interview with a loud mat, a couple of seconds after the project is shown in "C ++ Builder").

It is extremely useful to be able to write in C ++ for unix, if you want to write only for Windows, then it is useful to find a bit of winapi, but there is no sense to get deep at the initial stage.

according to the GUI in C ++, the best option is QT since it is win + unix and it is open and fairly well made, while developing GUI in C ++, it is most in demand abroad, but it is unjustly bypassed in our schools.


I personally see (by vacancies and acquaintance with programming languages ​​(PL)) that the GUI gradually disappears in C ++ (the exception of QT) and goes into higher-level languages ​​C #, Java, because there it is easier and cheaper to create complex projects (compared to C \ C ++), while C \ C ++ doesn’t die much, but simply goes to another work plane as a bunch C \ C ++ + (Java, C #), for example, as the "native part" + "wrapper" (android) or "low-level graphics engine" + "high-level game"

  • Functional style in C ++? Freshly. Lambdas do not give much in this direction. - alexlz
  • @alexlz op confused the functionals and procedures - strangeqargo

Look for example here: Writing drivers for Windows / Programming drivers and here: Books on C ++ and C

    How to write a driver? (which way to look, whether there are books or documentation). Read in the internet material on DDK. This is driver development.

    What generally should be written in c ++ and "how, what"? Whatever you wish. Limitations puts only fantasy.

    Which API is better to use for writing window applications and is it worth doing it with C ++? The interaction between windows in Windows goes through winApi. There will have to deal with the basics. To know the kitchen from the inside. All other interactions are an interlayer over winApi. For example, you can easily create a window application using Wtl or Mfc.

    PS In general, the best thing to find a friend or company and hang out with them. 2 months and you will start to swim in the material. :-)