Access to all array elements from a void pointer parameter passed to a function compliant with MISRA Rule...





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















Only embedded C.



I need a function to copy unsigned data from a 4-bytes array byte per byte to an output parameter (both passed as reference). Function should be MISRA 17.4 compliant and should support different unsigned integer datatype for output parameter (considering input will always have the exact number of unsigned bytes to fill the output)



So my code is:



static void copy_array(const void * src, void * dest, const uint8_t lenght_bytes)
{
uint8_t i;
const uint8_t * src_8 = (const uint8_t*)src;
uint8_t * dest_8 = (uint8_t*)dest;
for (i = 0u; i < lenght_bytes; i++)
{
*(dest_8 + i) = *(src_8 + i);
}
}

static void func(void)
{
uint8_t data = {0xEFu, 0xCDu, 0x0u, 0x0u};
uint16_t dest_16;
uint32_t dest_32;

copy_array(data, &dest_16, sizeof(dest_16));

data[0] = 0xEFu;
data[1] = 0xCDu;
data[2] = 0xABu;
data[3] = 0x89u;

copy_array(data, &dest_32, sizeof(dest_32));
}


So, MISRA limits pointer arithmetic operations only to array indexing, therefore, my function is not compliant.
Any smart way to avoid the rule or to perform same operation but MISRA compliant?










share|improve this question




















  • 2





    why not use memcpy?

    – P.W
    Nov 23 '18 at 6:40






  • 2





    dest_8[i] = src_8[i] ???

    – A.R.C.
    Nov 23 '18 at 6:51






  • 1





    @P.W Could be a requirement that all libraries are MISRA compliant. In which case you have to roll out memcpy yourself. Quite common (and unfortunate) for strict MISRA-C implementations.

    – Lundin
    Nov 23 '18 at 8:03











  • Any reason for using a homebrew function instead of the standard function memcpy every modern compiler knows and is able to highly optimise (and does exactly whatr you seem to intend)?

    – too honest for this site
    Nov 23 '18 at 19:09






  • 1





    @P.W memcpy isn't compliant with MISRA 17.4 and I'm not allowed to use it.

    – Gianpiero Trane
    Nov 24 '18 at 11:29


















0















Only embedded C.



I need a function to copy unsigned data from a 4-bytes array byte per byte to an output parameter (both passed as reference). Function should be MISRA 17.4 compliant and should support different unsigned integer datatype for output parameter (considering input will always have the exact number of unsigned bytes to fill the output)



So my code is:



static void copy_array(const void * src, void * dest, const uint8_t lenght_bytes)
{
uint8_t i;
const uint8_t * src_8 = (const uint8_t*)src;
uint8_t * dest_8 = (uint8_t*)dest;
for (i = 0u; i < lenght_bytes; i++)
{
*(dest_8 + i) = *(src_8 + i);
}
}

static void func(void)
{
uint8_t data = {0xEFu, 0xCDu, 0x0u, 0x0u};
uint16_t dest_16;
uint32_t dest_32;

copy_array(data, &dest_16, sizeof(dest_16));

data[0] = 0xEFu;
data[1] = 0xCDu;
data[2] = 0xABu;
data[3] = 0x89u;

copy_array(data, &dest_32, sizeof(dest_32));
}


So, MISRA limits pointer arithmetic operations only to array indexing, therefore, my function is not compliant.
Any smart way to avoid the rule or to perform same operation but MISRA compliant?










share|improve this question




















  • 2





    why not use memcpy?

    – P.W
    Nov 23 '18 at 6:40






  • 2





    dest_8[i] = src_8[i] ???

    – A.R.C.
    Nov 23 '18 at 6:51






  • 1





    @P.W Could be a requirement that all libraries are MISRA compliant. In which case you have to roll out memcpy yourself. Quite common (and unfortunate) for strict MISRA-C implementations.

    – Lundin
    Nov 23 '18 at 8:03











  • Any reason for using a homebrew function instead of the standard function memcpy every modern compiler knows and is able to highly optimise (and does exactly whatr you seem to intend)?

    – too honest for this site
    Nov 23 '18 at 19:09






  • 1





    @P.W memcpy isn't compliant with MISRA 17.4 and I'm not allowed to use it.

    – Gianpiero Trane
    Nov 24 '18 at 11:29














0












0








0


1






Only embedded C.



I need a function to copy unsigned data from a 4-bytes array byte per byte to an output parameter (both passed as reference). Function should be MISRA 17.4 compliant and should support different unsigned integer datatype for output parameter (considering input will always have the exact number of unsigned bytes to fill the output)



So my code is:



static void copy_array(const void * src, void * dest, const uint8_t lenght_bytes)
{
uint8_t i;
const uint8_t * src_8 = (const uint8_t*)src;
uint8_t * dest_8 = (uint8_t*)dest;
for (i = 0u; i < lenght_bytes; i++)
{
*(dest_8 + i) = *(src_8 + i);
}
}

static void func(void)
{
uint8_t data = {0xEFu, 0xCDu, 0x0u, 0x0u};
uint16_t dest_16;
uint32_t dest_32;

copy_array(data, &dest_16, sizeof(dest_16));

data[0] = 0xEFu;
data[1] = 0xCDu;
data[2] = 0xABu;
data[3] = 0x89u;

copy_array(data, &dest_32, sizeof(dest_32));
}


So, MISRA limits pointer arithmetic operations only to array indexing, therefore, my function is not compliant.
Any smart way to avoid the rule or to perform same operation but MISRA compliant?










share|improve this question
















Only embedded C.



I need a function to copy unsigned data from a 4-bytes array byte per byte to an output parameter (both passed as reference). Function should be MISRA 17.4 compliant and should support different unsigned integer datatype for output parameter (considering input will always have the exact number of unsigned bytes to fill the output)



So my code is:



static void copy_array(const void * src, void * dest, const uint8_t lenght_bytes)
{
uint8_t i;
const uint8_t * src_8 = (const uint8_t*)src;
uint8_t * dest_8 = (uint8_t*)dest;
for (i = 0u; i < lenght_bytes; i++)
{
*(dest_8 + i) = *(src_8 + i);
}
}

static void func(void)
{
uint8_t data = {0xEFu, 0xCDu, 0x0u, 0x0u};
uint16_t dest_16;
uint32_t dest_32;

copy_array(data, &dest_16, sizeof(dest_16));

data[0] = 0xEFu;
data[1] = 0xCDu;
data[2] = 0xABu;
data[3] = 0x89u;

copy_array(data, &dest_32, sizeof(dest_32));
}


So, MISRA limits pointer arithmetic operations only to array indexing, therefore, my function is not compliant.
Any smart way to avoid the rule or to perform same operation but MISRA compliant?







c embedded void-pointers misra






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 24 '18 at 11:19







Gianpiero Trane

















asked Nov 22 '18 at 19:37









Gianpiero TraneGianpiero Trane

61




61








  • 2





    why not use memcpy?

    – P.W
    Nov 23 '18 at 6:40






  • 2





    dest_8[i] = src_8[i] ???

    – A.R.C.
    Nov 23 '18 at 6:51






  • 1





    @P.W Could be a requirement that all libraries are MISRA compliant. In which case you have to roll out memcpy yourself. Quite common (and unfortunate) for strict MISRA-C implementations.

    – Lundin
    Nov 23 '18 at 8:03











  • Any reason for using a homebrew function instead of the standard function memcpy every modern compiler knows and is able to highly optimise (and does exactly whatr you seem to intend)?

    – too honest for this site
    Nov 23 '18 at 19:09






  • 1





    @P.W memcpy isn't compliant with MISRA 17.4 and I'm not allowed to use it.

    – Gianpiero Trane
    Nov 24 '18 at 11:29














  • 2





    why not use memcpy?

    – P.W
    Nov 23 '18 at 6:40






  • 2





    dest_8[i] = src_8[i] ???

    – A.R.C.
    Nov 23 '18 at 6:51






  • 1





    @P.W Could be a requirement that all libraries are MISRA compliant. In which case you have to roll out memcpy yourself. Quite common (and unfortunate) for strict MISRA-C implementations.

    – Lundin
    Nov 23 '18 at 8:03











  • Any reason for using a homebrew function instead of the standard function memcpy every modern compiler knows and is able to highly optimise (and does exactly whatr you seem to intend)?

    – too honest for this site
    Nov 23 '18 at 19:09






  • 1





    @P.W memcpy isn't compliant with MISRA 17.4 and I'm not allowed to use it.

    – Gianpiero Trane
    Nov 24 '18 at 11:29








2




2





why not use memcpy?

– P.W
Nov 23 '18 at 6:40





why not use memcpy?

– P.W
Nov 23 '18 at 6:40




2




2





dest_8[i] = src_8[i] ???

– A.R.C.
Nov 23 '18 at 6:51





dest_8[i] = src_8[i] ???

– A.R.C.
Nov 23 '18 at 6:51




1




1





@P.W Could be a requirement that all libraries are MISRA compliant. In which case you have to roll out memcpy yourself. Quite common (and unfortunate) for strict MISRA-C implementations.

– Lundin
Nov 23 '18 at 8:03





@P.W Could be a requirement that all libraries are MISRA compliant. In which case you have to roll out memcpy yourself. Quite common (and unfortunate) for strict MISRA-C implementations.

– Lundin
Nov 23 '18 at 8:03













Any reason for using a homebrew function instead of the standard function memcpy every modern compiler knows and is able to highly optimise (and does exactly whatr you seem to intend)?

– too honest for this site
Nov 23 '18 at 19:09





Any reason for using a homebrew function instead of the standard function memcpy every modern compiler knows and is able to highly optimise (and does exactly whatr you seem to intend)?

– too honest for this site
Nov 23 '18 at 19:09




1




1





@P.W memcpy isn't compliant with MISRA 17.4 and I'm not allowed to use it.

– Gianpiero Trane
Nov 24 '18 at 11:29





@P.W memcpy isn't compliant with MISRA 17.4 and I'm not allowed to use it.

– Gianpiero Trane
Nov 24 '18 at 11:29












1 Answer
1






active

oldest

votes


















5














First of all, this is not valid C:



uint8_t data[4] = {0xEFu, 0xCDu, NULL, NULL};


Since NULL might be a null pointer constant of the form (void*)0. Replace NULL with 0 here.





As for the old MISRA-C:2004 requirement about array indexing being the only allowed form, it was mostly nonsense and has been fixed in the current MISRA-C:2012. That being said, there is no need for explicit pointer arithmetic in your code, so that rule makes sense here.



Simply fix the function like this:



static void copy_array(const void* src, void* dest, const uint8_t lenght_bytes)
{
uint8_t i;
const uint8_t* src_8 = src;
uint8_t* dest_8 = dest;

for (i = 0u; i < lenght_bytes; i++)
{
dest_8[i] = src_8[i];
}
}





share|improve this answer


























  • Thanks @Lundin. You are right, not valid initialization, it was just example but I updated to avoid confusion. Regarding your solution, I'm afraid MISRA 17.4 does not allow use [ ] at a variable declared as a pointer, not as an array.

    – Gianpiero Trane
    Nov 24 '18 at 11:22








  • 1





    @GianpieroTrane Of course they do, what they don't allow is pointer arithmetic with *(ptr + n) instead of ptr[n] as the former is harder to read.

    – Lundin
    Nov 25 '18 at 15:03






  • 1





    Rule 17.4 Array indexing shall be the only allowed form of pointer. Arithmetic array indexing shall only be applied to objects defined as an array type.

    – Gianpiero Trane
    Nov 26 '18 at 10:13













  • Rule 17.4 is simply "No pointer arithmetic other than array indexing". That being said a google search on your phrase brings up Goanna Studio - Static Analysis check rule of "Array indexing shall only be applied to objects defined as an array type." You should ask those Goanna folks how to pass an array into a function because their examples don't cover that.

    – Fred
    Nov 27 '18 at 23:17











  • @Lundin What about the dest? It is declared as uint16_t dest_16, but MISRA 2004 explicitely states that Array indexing shall only be applied to objects defined as an array type. Not helpful in cases like this, but required nonetheless.

    – ZenJ
    Nov 28 '18 at 23:53












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53437181%2faccess-to-all-array-elements-from-a-void-pointer-parameter-passed-to-a-function%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









5














First of all, this is not valid C:



uint8_t data[4] = {0xEFu, 0xCDu, NULL, NULL};


Since NULL might be a null pointer constant of the form (void*)0. Replace NULL with 0 here.





As for the old MISRA-C:2004 requirement about array indexing being the only allowed form, it was mostly nonsense and has been fixed in the current MISRA-C:2012. That being said, there is no need for explicit pointer arithmetic in your code, so that rule makes sense here.



Simply fix the function like this:



static void copy_array(const void* src, void* dest, const uint8_t lenght_bytes)
{
uint8_t i;
const uint8_t* src_8 = src;
uint8_t* dest_8 = dest;

for (i = 0u; i < lenght_bytes; i++)
{
dest_8[i] = src_8[i];
}
}





share|improve this answer


























  • Thanks @Lundin. You are right, not valid initialization, it was just example but I updated to avoid confusion. Regarding your solution, I'm afraid MISRA 17.4 does not allow use [ ] at a variable declared as a pointer, not as an array.

    – Gianpiero Trane
    Nov 24 '18 at 11:22








  • 1





    @GianpieroTrane Of course they do, what they don't allow is pointer arithmetic with *(ptr + n) instead of ptr[n] as the former is harder to read.

    – Lundin
    Nov 25 '18 at 15:03






  • 1





    Rule 17.4 Array indexing shall be the only allowed form of pointer. Arithmetic array indexing shall only be applied to objects defined as an array type.

    – Gianpiero Trane
    Nov 26 '18 at 10:13













  • Rule 17.4 is simply "No pointer arithmetic other than array indexing". That being said a google search on your phrase brings up Goanna Studio - Static Analysis check rule of "Array indexing shall only be applied to objects defined as an array type." You should ask those Goanna folks how to pass an array into a function because their examples don't cover that.

    – Fred
    Nov 27 '18 at 23:17











  • @Lundin What about the dest? It is declared as uint16_t dest_16, but MISRA 2004 explicitely states that Array indexing shall only be applied to objects defined as an array type. Not helpful in cases like this, but required nonetheless.

    – ZenJ
    Nov 28 '18 at 23:53
















5














First of all, this is not valid C:



uint8_t data[4] = {0xEFu, 0xCDu, NULL, NULL};


Since NULL might be a null pointer constant of the form (void*)0. Replace NULL with 0 here.





As for the old MISRA-C:2004 requirement about array indexing being the only allowed form, it was mostly nonsense and has been fixed in the current MISRA-C:2012. That being said, there is no need for explicit pointer arithmetic in your code, so that rule makes sense here.



Simply fix the function like this:



static void copy_array(const void* src, void* dest, const uint8_t lenght_bytes)
{
uint8_t i;
const uint8_t* src_8 = src;
uint8_t* dest_8 = dest;

for (i = 0u; i < lenght_bytes; i++)
{
dest_8[i] = src_8[i];
}
}





share|improve this answer


























  • Thanks @Lundin. You are right, not valid initialization, it was just example but I updated to avoid confusion. Regarding your solution, I'm afraid MISRA 17.4 does not allow use [ ] at a variable declared as a pointer, not as an array.

    – Gianpiero Trane
    Nov 24 '18 at 11:22








  • 1





    @GianpieroTrane Of course they do, what they don't allow is pointer arithmetic with *(ptr + n) instead of ptr[n] as the former is harder to read.

    – Lundin
    Nov 25 '18 at 15:03






  • 1





    Rule 17.4 Array indexing shall be the only allowed form of pointer. Arithmetic array indexing shall only be applied to objects defined as an array type.

    – Gianpiero Trane
    Nov 26 '18 at 10:13













  • Rule 17.4 is simply "No pointer arithmetic other than array indexing". That being said a google search on your phrase brings up Goanna Studio - Static Analysis check rule of "Array indexing shall only be applied to objects defined as an array type." You should ask those Goanna folks how to pass an array into a function because their examples don't cover that.

    – Fred
    Nov 27 '18 at 23:17











  • @Lundin What about the dest? It is declared as uint16_t dest_16, but MISRA 2004 explicitely states that Array indexing shall only be applied to objects defined as an array type. Not helpful in cases like this, but required nonetheless.

    – ZenJ
    Nov 28 '18 at 23:53














5












5








5







First of all, this is not valid C:



uint8_t data[4] = {0xEFu, 0xCDu, NULL, NULL};


Since NULL might be a null pointer constant of the form (void*)0. Replace NULL with 0 here.





As for the old MISRA-C:2004 requirement about array indexing being the only allowed form, it was mostly nonsense and has been fixed in the current MISRA-C:2012. That being said, there is no need for explicit pointer arithmetic in your code, so that rule makes sense here.



Simply fix the function like this:



static void copy_array(const void* src, void* dest, const uint8_t lenght_bytes)
{
uint8_t i;
const uint8_t* src_8 = src;
uint8_t* dest_8 = dest;

for (i = 0u; i < lenght_bytes; i++)
{
dest_8[i] = src_8[i];
}
}





share|improve this answer















First of all, this is not valid C:



uint8_t data[4] = {0xEFu, 0xCDu, NULL, NULL};


Since NULL might be a null pointer constant of the form (void*)0. Replace NULL with 0 here.





As for the old MISRA-C:2004 requirement about array indexing being the only allowed form, it was mostly nonsense and has been fixed in the current MISRA-C:2012. That being said, there is no need for explicit pointer arithmetic in your code, so that rule makes sense here.



Simply fix the function like this:



static void copy_array(const void* src, void* dest, const uint8_t lenght_bytes)
{
uint8_t i;
const uint8_t* src_8 = src;
uint8_t* dest_8 = dest;

for (i = 0u; i < lenght_bytes; i++)
{
dest_8[i] = src_8[i];
}
}






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 23 '18 at 9:02

























answered Nov 23 '18 at 8:02









LundinLundin

113k17163273




113k17163273













  • Thanks @Lundin. You are right, not valid initialization, it was just example but I updated to avoid confusion. Regarding your solution, I'm afraid MISRA 17.4 does not allow use [ ] at a variable declared as a pointer, not as an array.

    – Gianpiero Trane
    Nov 24 '18 at 11:22








  • 1





    @GianpieroTrane Of course they do, what they don't allow is pointer arithmetic with *(ptr + n) instead of ptr[n] as the former is harder to read.

    – Lundin
    Nov 25 '18 at 15:03






  • 1





    Rule 17.4 Array indexing shall be the only allowed form of pointer. Arithmetic array indexing shall only be applied to objects defined as an array type.

    – Gianpiero Trane
    Nov 26 '18 at 10:13













  • Rule 17.4 is simply "No pointer arithmetic other than array indexing". That being said a google search on your phrase brings up Goanna Studio - Static Analysis check rule of "Array indexing shall only be applied to objects defined as an array type." You should ask those Goanna folks how to pass an array into a function because their examples don't cover that.

    – Fred
    Nov 27 '18 at 23:17











  • @Lundin What about the dest? It is declared as uint16_t dest_16, but MISRA 2004 explicitely states that Array indexing shall only be applied to objects defined as an array type. Not helpful in cases like this, but required nonetheless.

    – ZenJ
    Nov 28 '18 at 23:53



















  • Thanks @Lundin. You are right, not valid initialization, it was just example but I updated to avoid confusion. Regarding your solution, I'm afraid MISRA 17.4 does not allow use [ ] at a variable declared as a pointer, not as an array.

    – Gianpiero Trane
    Nov 24 '18 at 11:22








  • 1





    @GianpieroTrane Of course they do, what they don't allow is pointer arithmetic with *(ptr + n) instead of ptr[n] as the former is harder to read.

    – Lundin
    Nov 25 '18 at 15:03






  • 1





    Rule 17.4 Array indexing shall be the only allowed form of pointer. Arithmetic array indexing shall only be applied to objects defined as an array type.

    – Gianpiero Trane
    Nov 26 '18 at 10:13













  • Rule 17.4 is simply "No pointer arithmetic other than array indexing". That being said a google search on your phrase brings up Goanna Studio - Static Analysis check rule of "Array indexing shall only be applied to objects defined as an array type." You should ask those Goanna folks how to pass an array into a function because their examples don't cover that.

    – Fred
    Nov 27 '18 at 23:17











  • @Lundin What about the dest? It is declared as uint16_t dest_16, but MISRA 2004 explicitely states that Array indexing shall only be applied to objects defined as an array type. Not helpful in cases like this, but required nonetheless.

    – ZenJ
    Nov 28 '18 at 23:53

















Thanks @Lundin. You are right, not valid initialization, it was just example but I updated to avoid confusion. Regarding your solution, I'm afraid MISRA 17.4 does not allow use [ ] at a variable declared as a pointer, not as an array.

– Gianpiero Trane
Nov 24 '18 at 11:22







Thanks @Lundin. You are right, not valid initialization, it was just example but I updated to avoid confusion. Regarding your solution, I'm afraid MISRA 17.4 does not allow use [ ] at a variable declared as a pointer, not as an array.

– Gianpiero Trane
Nov 24 '18 at 11:22






1




1





@GianpieroTrane Of course they do, what they don't allow is pointer arithmetic with *(ptr + n) instead of ptr[n] as the former is harder to read.

– Lundin
Nov 25 '18 at 15:03





@GianpieroTrane Of course they do, what they don't allow is pointer arithmetic with *(ptr + n) instead of ptr[n] as the former is harder to read.

– Lundin
Nov 25 '18 at 15:03




1




1





Rule 17.4 Array indexing shall be the only allowed form of pointer. Arithmetic array indexing shall only be applied to objects defined as an array type.

– Gianpiero Trane
Nov 26 '18 at 10:13







Rule 17.4 Array indexing shall be the only allowed form of pointer. Arithmetic array indexing shall only be applied to objects defined as an array type.

– Gianpiero Trane
Nov 26 '18 at 10:13















Rule 17.4 is simply "No pointer arithmetic other than array indexing". That being said a google search on your phrase brings up Goanna Studio - Static Analysis check rule of "Array indexing shall only be applied to objects defined as an array type." You should ask those Goanna folks how to pass an array into a function because their examples don't cover that.

– Fred
Nov 27 '18 at 23:17





Rule 17.4 is simply "No pointer arithmetic other than array indexing". That being said a google search on your phrase brings up Goanna Studio - Static Analysis check rule of "Array indexing shall only be applied to objects defined as an array type." You should ask those Goanna folks how to pass an array into a function because their examples don't cover that.

– Fred
Nov 27 '18 at 23:17













@Lundin What about the dest? It is declared as uint16_t dest_16, but MISRA 2004 explicitely states that Array indexing shall only be applied to objects defined as an array type. Not helpful in cases like this, but required nonetheless.

– ZenJ
Nov 28 '18 at 23:53





@Lundin What about the dest? It is declared as uint16_t dest_16, but MISRA 2004 explicitely states that Array indexing shall only be applied to objects defined as an array type. Not helpful in cases like this, but required nonetheless.

– ZenJ
Nov 28 '18 at 23:53




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53437181%2faccess-to-all-array-elements-from-a-void-pointer-parameter-passed-to-a-function%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

mysqli_query(): Empty query in /home/lucindabrummitt/public_html/blog/wp-includes/wp-db.php on line 1924

How to change which sound is reproduced for terminal bell?

Can I use Tabulator js library in my java Spring + Thymeleaf project?