ID: cpp/integer-used-for-enum Kind: problem Security severity: Severity: warning Precision: medium Tags: - maintainability - readability - language-features - external/jsf Query suites: - cpp-security-and-quality.qls Click to see the query in the CodeQL repositoryThis rule finds switch ...
[ 44%] Building CXX object src/svg/CMakeFiles/Svg.dir/qsvgtinydocument.cpp.o Tiedostossa, joka sisällytettiin kohdasta .../qtsvg-everywhere-src-6.4.2/src/svg/qsvgrenderer.cpp:502: .../qtsvg-everywhere-src-6.4.2-build/src/svg/Svg_autogen/include/moc_qsvgrenderer.cpp:12:10: va...
Error-codes are ancient and usedeverywhere. For simplicity, let’s assume error-codes are just integers, but they could be implemented as type-safe enums or even complex objects. For this discussion it won’t really matter. There are 3 common forms of error-code imple...
Makes sense. I'll implement the RFC in the new year. We might run into further questions about what to do with enums and other things currently handled for us by the usual unary conversions. I think we'll have to roll our own solution as I haven't seen anything suitable. My knowledge...
Read the arguments to VirtualAlloc() in the question again: the two allocations use two different ranges of pages. I'm having a similar problem, where code that walks the virtual space calling VirtualAlloc() with specific base addresses fails to find *any* allocatable space within a 1 GB ...
// example2.cpp// stack-use-after-return error#include<stdlib.h>enumReadOrWrite { Read =0, Write =1};structS32{charx[32]; };template<classT>T*LeakStack() {T t[100];staticvolatileT* x; x = &t[0];return(T*)x; }template<classT>voidStackUseAfterReturn(intIdx,ReadOrWritew) {...
#include <stdatomic.h> #include <stdio.h> #include <stdlib.h> #include <threads.h> #include <unistd.h> #ifndef NUM_THREADS #define NUM_THREADS 4 #endif atomic_int counter = 0; enum { MAX_ITER = 10000 }; void incrementCounter(void *thr_id) { long tid; tid = (long)thr_id; pr...
#include<stdio.h>#include<stdlib.h>enum{SIZE=20};intmain(void){charbuf[SIZE];intch;size_t index=0;size_t chars_read=0;printf("Please, provide input: ");while((ch=getchar())!='\n'&&ch!=EOF){if(index<sizeof(buf)-1){buf[index++]=(char)ch;}chars_read++;}buf[index]='\0...
Encapsulating Enums Building Mixed-Mode DLLs Fun with RegexWrap Conclusion The Managed Extensions for C++ make it possible to mix native and managed code freely, even in the same module. Wow, life is good! Compiling with /clr, however, has consequences you may not want. It forces multithreadi...
In my previous article we looked at the main programs that are used by MQL5 programmers (and came to the conclusion that the MetaEditor IDE is well suited for beginner needs). In addition, we took a quick look at the concept of a function and created a simple script that prints a messag...