johnsonjh / johnsonjh/duma

error C2036: “const void *”: unknown size in pointer arithmetic

Open
#183 1 comment 0 reactions 1 assignee Claimed by @johnsonjh View on GitHub
Dominant language
C
Stars
121
Forks
12
Avg merge
3h 13m
Merged PRs (30d)
1

Description

In src/duma.c line 2254:
```cpp
void *_duma_memmove(void *dest, const void *src, size_t size) {
char *d = (char *)dest;
const char *s = (const char *)src;

if (d < s) {
--> const char *end = src + size;
```
In MSVC, it will raise an error:
```
error C2036: “const void *”: unknown size
```
Because the compiler needs to know the size of the data it points to do the pointer arithmetic.

Note:
```cpp
int* p = 0x0; // Just for example
p += 1;
// p is 0x4 now

char* cp = 0x0;
cp += 1;
// cp is 0x1 now
```

So, change this line to:
```cpp
const char *end = (const char*) src + size;
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.