Click here to Skip to main content
15,886,199 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
Questionhow to implement CButton as CListbox item Pin
rtischer82776-May-22 2:51
rtischer82776-May-22 2:51 
AnswerRe: how to implement CButton as CListbox item Pin
CHill606-May-22 5:12
mveCHill606-May-22 5:12 
GeneralRe: how to implement CButton as CListbox item Pin
rtischer82779-May-22 1:56
rtischer82779-May-22 1:56 
AnswerRe: how to implement CButton as CListbox item Pin
longjmp18-Nov-22 7:44
longjmp18-Nov-22 7:44 
QuestionHow can I get access to CXXView variables from a Parent Class in MFC Pin
Member 1503370419-Jan-21 7:34
Member 1503370419-Jan-21 7:34 
AnswerRe: How can I get access to CXXView variables from a Parent Class in MFC Pin
Victor Nijegorodov19-Jan-21 20:52
Victor Nijegorodov19-Jan-21 20:52 
GeneralRe: How can I get access to CXXView variables from a Parent Class in MFC Pin
Member 1503370419-Jan-21 23:13
Member 1503370419-Jan-21 23:13 
GeneralRe: How can I get access to CXXView variables from a Parent Class in MFC Pin
Victor Nijegorodov20-Jan-21 8:10
Victor Nijegorodov20-Jan-21 8:10 
GeneralRe: How can I get access to CXXView variables from a Parent Class in MFC Pin
Member 1503370421-Jan-21 5:58
Member 1503370421-Jan-21 5:58 
Questioncode of this question Pin
avadhnaresh kushwaha12-Aug-20 8:17
avadhnaresh kushwaha12-Aug-20 8:17 
AnswerRe: code of this question Pin
Richard MacCutchan12-Aug-20 8:19
mveRichard MacCutchan12-Aug-20 8:19 
QuestionKeypad locks Pin
kalberts7-Mar-20 13:23
kalberts7-Mar-20 13:23 
QuestionTo insert a node at the back of a XOR doubly linked list Pin
Tarun Jha17-Oct-19 9:38
Tarun Jha17-Oct-19 9:38 
AnswerRe: To insert a node at the back of a XOR doubly linked list Pin
ZurdoDev10-Jan-20 1:02
professionalZurdoDev10-Jan-20 1:02 
QuestionWhy non-template function does not compile where as template function compiles? Pin
PBMBJoshi2-May-19 23:23
PBMBJoshi2-May-19 23:23 
AnswerRe: Why non-template function does not compile where as template function compiles? Pin
Richard MacCutchan2-May-19 23:29
mveRichard MacCutchan2-May-19 23:29 
AnswerRe: Why non-template function does not compile where as template function compiles? Pin
k505410-Oct-19 8:53
mvek505410-Oct-19 8:53 
QuestionAdvice on interdependent asynchronous functions and task queuing? Pin
arnold_w7-Feb-19 23:07
arnold_w7-Feb-19 23:07 
AnswerRe: Advice on interdependent asynchronous functions and task queuing? Pin
arnold_w7-Feb-19 23:34
arnold_w7-Feb-19 23:34 
QuestionRecommended way to deal with queues and pointers to buffers Pin
arnold_w3-Feb-19 9:09
arnold_w3-Feb-19 9:09 
AnswerRe: Recommended way to deal with queues and pointers to buffers Pin
Richard MacCutchan3-Feb-19 22:19
mveRichard MacCutchan3-Feb-19 22:19 
GeneralRe: Recommended way to deal with queues and pointers to buffers Pin
arnold_w3-Feb-19 23:40
arnold_w3-Feb-19 23:40 
GeneralRe: Recommended way to deal with queues and pointers to buffers Pin
Richard MacCutchan3-Feb-19 23:48
mveRichard MacCutchan3-Feb-19 23:48 
GeneralRe: Recommended way to deal with queues and pointers to buffers Pin
arnold_w4-Feb-19 3:15
arnold_w4-Feb-19 3:15 
I don't think I can guarantee that the static non-queued buffers can be put in the end of the structs because most of the time the structs will be created on the stack. Therefore, I think I need pointers to the buffers.

I also have a CAN-bus interface and typically the receive packet task would take a struct that looks like this:
C++
struct packet_s {
    uint32_t  extID;
    uint8_t   DLC;    // Data Length Count (=size of packet in bytes)
    uint8_t*  data;
};
In my application these packets will always be queued (they never use static buffers) and as soon as they are queued the data pointer becomes worthless. The best thing I can think of is the following (a slight variation of Richard MacCutchan's suggestion):
C++
#define PLEASE_SEE_DLC_FOR_PACKET_SIZE     (1)

struct packet_s {
    uint32_t  extID;
    uint8_t   DLC;    // Data Length Count (=size of packet in bytes)
    uint8_t   data[PLEASE_SEE_DLC_FOR_PACKET_SIZE];
};


modified 4-Feb-19 9:27am.

GeneralRe: Recommended way to deal with queues and pointers to buffers Pin
Richard MacCutchan4-Feb-19 3:46
mveRichard MacCutchan4-Feb-19 3:46 

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.