Click here to Skip to main content
14,689,513 members
Home » Discussions » C / C++ / MFC
   

C / C++ / MFC

 
Questioncompilers for pure assembly code Pin
CalinNegru(fearless_)19-Sep-20 1:46
MemberCalinNegru(fearless_)19-Sep-20 1:46 
AnswerRe: compilers for pure assembly code Pin
Richard MacCutchan19-Sep-20 3:24
mveRichard MacCutchan19-Sep-20 3:24 
AnswerRe: compilers for pure assembly code Pin
Joe Woodbury22-Sep-20 12:38
professionalJoe Woodbury22-Sep-20 12:38 
AnswerRe: compilers for pure assembly code Pin
CalinNegru(fearless_)24-Sep-20 2:00
MemberCalinNegru(fearless_)24-Sep-20 2:00 
QuestionWhy do I get "undefined reference to..." when trying to call a C-function inside a .cpp-file? Pin
arnold_w10-Sep-20 5:54
Memberarnold_w10-Sep-20 5:54 
AnswerRe: Why do I get "undefined reference to..." when trying to call a C-function inside a .cpp-file? PinPopular
Richard MacCutchan10-Sep-20 6:30
mveRichard MacCutchan10-Sep-20 6:30 
QuestionIcons for Executable Files - SOLVED Pin
Richard Andrew x649-Sep-20 15:55
professionalRichard Andrew x649-Sep-20 15:55 
QuestionWhat's the closest thing to an anonymous struct/array I can achieve that compiles with GCC? Pin
arnold_w9-Sep-20 9:16
Memberarnold_w9-Sep-20 9:16 
I am writing code for an ARM processor and compiling with GCC. I have done some C# programming and there you're allowed to pass anonymous arrays and structs directly in method calls:
MyClass.MyMethod1(new byte[]{0, 1, 2, 3}); // This is allowed in C#
and
MyClass.MyMethod2(new MyStruct("", 0, null)); // This is allowed in C#
What's the closest thing I can achieve the same thing in my ARM-project?
myFunction1({0, 1, 2, 3});  // What I want (or something similar) that compiles in GCC
myFunction2({"", 0, NULL}); // What I want (or something similar) that compiles in GCC
I understand that I could change my function to take a function pointer instead of a struct as a parameter using the technique described in Re: What's the closest thing to anonymous function pointers I can achieve that compiles with GCC? - C / C++ / MFC Discussion Boards[^]:
#include <functional>
using namespace std;
using getMyStructCallback_t = function <struct MyStruct*()>;

void myFunction(getMyStructCallback_t getMyStructCallback); // Declaration as it appears in the h-file

myFunction([]() {
    static struct MyStruct myStruct = {"", 0, NULL}; // What I'm aware is possible, but would like to avoid
    return &myStruct;}                               // What I'm aware is possible, but would like to avoid
);
but if possible, then I would like to pass my struct/array directly.
AnswerRe: What's the closest thing to an anonymous struct/array I can achieve that compiles with GCC? Pin
Mircea Neacsu9-Sep-20 12:20
MemberMircea Neacsu9-Sep-20 12:20 
GeneralRe: What's the closest thing to an anonymous struct/array I can achieve that compiles with GCC? Pin
arnold_w9-Sep-20 12:33
Memberarnold_w9-Sep-20 12:33 
AnswerRe: What's the closest thing to an anonymous struct/array I can achieve that compiles with GCC? Pin
Mircea Neacsu9-Sep-20 13:11
MemberMircea Neacsu9-Sep-20 13:11 
GeneralRe: What's the closest thing to an anonymous struct/array I can achieve that compiles with GCC? Pin
arnold_w9-Sep-20 13:28
Memberarnold_w9-Sep-20 13:28 
GeneralRe: What's the closest thing to an anonymous struct/array I can achieve that compiles with GCC? Pin
Randor 9-Sep-20 13:44
professional Randor 9-Sep-20 13:44 
AnswerRe: What's the closest thing to an anonymous struct/array I can achieve that compiles with GCC? Pin
Joe Woodbury9-Sep-20 13:38
professionalJoe Woodbury9-Sep-20 13:38 
GeneralRe: What's the closest thing to an anonymous struct/array I can achieve that compiles with GCC? Pin
arnold_w9-Sep-20 15:35
Memberarnold_w9-Sep-20 15:35 
GeneralRe: What's the closest thing to an anonymous struct/array I can achieve that compiles with GCC? Pin
Joe Woodbury9-Sep-20 16:14
professionalJoe Woodbury9-Sep-20 16:14 
GeneralRe: What's the closest thing to an anonymous struct/array I can achieve that compiles with GCC? Pin
Stefan_Lang15-Sep-20 4:34
mveStefan_Lang15-Sep-20 4:34 
AnswerRe: What's the closest thing to an anonymous struct/array I can achieve that compiles with GCC? Pin
arnold_w11-Sep-20 13:46
Memberarnold_w11-Sep-20 13:46 
QuestionCWinThread for background processing Pin
Richard Andrew x645-Sep-20 11:13
professionalRichard Andrew x645-Sep-20 11:13 
AnswerRe: CWinThread for background processing Pin
Mircea Neacsu5-Sep-20 17:18
MemberMircea Neacsu5-Sep-20 17:18 
GeneralRe: CWinThread for background processing Pin
Richard Andrew x645-Sep-20 18:03
professionalRichard Andrew x645-Sep-20 18:03 
AnswerRe: CWinThread for background processing Pin
Randor 5-Sep-20 17:44
professional Randor 5-Sep-20 17:44 
GeneralRe: CWinThread for background processing Pin
Richard Andrew x645-Sep-20 18:01
professionalRichard Andrew x645-Sep-20 18:01 
GeneralRe: CWinThread for background processing Pin
Randor 5-Sep-20 18:29
professional Randor 5-Sep-20 18:29 
PraiseRe: CWinThread for background processing Pin
CPallini7-Sep-20 2:33
mveCPallini7-Sep-20 2:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.