1,455 questions
0
votes
1
answer
36
views
Making portable c++ shared library for older machines
I have developed code using
g++ -std=c++23, using features of this new standard. The output is a shared library which is used by a binary executable, and which would also be called as the backend from ...
0
votes
2
answers
84
views
How can you portably echo a shell string without using printf?
I want to write the contents of a shell variable into a pipe, as it is, without modification. "echo -n" would be nice too.
Everyone says "use printf", something like
echo() {
...
0
votes
1
answer
57
views
Spring Boot Java 11 in Debian 12 with tomcat10
I've switching a Java 11 spring boot war to tomcat10 on Debian 12 from Debian 11 and want to build with maven using existing definitions in a pom.xml file.
I don't want to use:
Java 17
Jakarta ...
0
votes
1
answer
106
views
Why MSVC is allowing direct instantiations of objects with protected destructor?
In a library I am working on, whose purpose is to wrap a C modelling library, I have a type EntityBase which serves as the base class for other classes like Body, Face, etc...:
class EntityBase
{
...
2
votes
2
answers
141
views
Is there a way to determine if the representation of a pointer is 'linear' in C?
In C, there is no guarantee that the behavior of pointer arithmetic reflects the behavior of integer arithmetic if the pointer is converted to an integer, as far as I know. In other words, there is no ...
0
votes
1
answer
83
views
Should Portable Types Be Used in the Declaration of a Main Function? (C11)
This question came to me last night, and I couldn't find a definitive answer in my brief surf of Google. Should (or could) I use portable types (i.e int32_t) in the declaration of my program's main ...
1
vote
0
answers
28
views
Relative Git path in VS Code portable
Running VSCode portable 1.90.2, Git portable 2.45.2
I currently have a folder structured like so:
Drive D
|-- folder
| |-- code
| |-- ...
| |-- Code.exe
| |-- data
| |-- ...
2
votes
2
answers
164
views
How to create a portable structure to emulate 16-bit registers in C?
I am working on a gameboy emulator. The gameboy CPU uses 16-bit registers whose upper and lower bytes can be accessed and operated on individually as well as the entire 16-bits. How do I implement it ...
0
votes
0
answers
30
views
Is there any way to disable Excel's automatic addition of fully qualified references (absolute file path) to UDFs in xlam add-ins?
I have written several UDFs that I want to be able to use on multiple computers. To avoid copying these to every single computer every single time I add or improve one, my current solution is to store ...
0
votes
0
answers
25
views
Mobile printing PT200 tru Bluetooth opened in web app
I develop a pos system develop in phi. My server is using pc. The system develop for online access. Now the system acces through android phone by typing url of website. On that website opened in ...
4
votes
1
answer
153
views
Are there any specific types or values for which type-punning produces identical behavior in all Standard-conforming C implementations?
Type-punning or reinterpreting the underlying bits from one type to another is notorious for having unpredictable and/or non-portable behavior.
For example:
union {
unsigned u;
float f;
} c = {...
3
votes
1
answer
404
views
How to embed C dynamic libraries into Go binary
I have a Golang project which uses some C libraries from another team in my company which come with shared objects and would be very difficult to compile statically.
I would like to keep the binary ...
1
vote
0
answers
77
views
Compiling a portable high level language package for wrapping a c/c++ lib
I am working on a package for a high level language (Matlab) that wraps the functions provided by a third party c/c++ lib.
Goal
Pre-compile the package such that it can be run on any computer without ...
1
vote
1
answer
119
views
Unable to run The .NET Portability Analyzer on the Microsoft Windows Server 2016 (Datacenter)
I was assigned with the .NET Portability Analyzer scan on the Microsoft Windows Server 2016 (Datacenter)
On that datacenter we host ASP.NET Web Forms application hosted on the IIS version 10
I was ...
0
votes
1
answer
128
views
value of OPEN_MAX
What is the value of OPEN_MAX on various platforms?
I know that the dynamic limit for the number of open file descriptors can be retrieved through sysconf (_SC_OPEN_MAX), getdtablesize (), or ...
1
vote
1
answer
255
views
Syscall vs System Call Wrappers, portability
So i'm struggling with the concept of syscall() and portability. I have heard that using a system call wrapper is more portable then just making a system call but why? I get that portability refers ...
0
votes
0
answers
25
views
CodeOSS portable build support?
I recently discovered Code OSS (vscode under MIT license) and I quite like the idea of building my own version.
For some reason I don't want to explain, I need a portable build of the open license ...
1
vote
1
answer
116
views
Portability of __builtin_clzll for calculating floor power of 2 and fallback options
I have two alternative code implementations for calculating the largest power of 2 smaller than a given 64-bit unsigned integer (uint64_t):
Implementation 1:
#include <iostream>
#include <...
1
vote
0
answers
93
views
Differences between POSIX O_SEARCH, and Linux O_PATH applied to a directory?
POSIX.1-2008 specifies an open(2) flag O_SEARCH which is specified in one sentence
Open directory for search only.
plus more verbiage scattered over the definition of all the file-access system ...
1
vote
0
answers
321
views
Truly portable executables written in python in 2023
I've recently spent a lot of time figuring out how to distribute tools written in Python as standalone, self-contained executables, that will works on most of the linux distribution without special ...
0
votes
1
answer
95
views
What are Docker's HW portability limitations?
I have only read some introductory articles - some of which may have been older and might be obsolete by now. With regard to portability these texts usually talked about different OS versions but not ...
1
vote
1
answer
298
views
What is the safest and most well-defined way to perform narrowing type conversions with signed integers in C?
I have read: What happens when I assign long int to int in C?
int64_t x;
int32_t y;
y = (int32_t)x;
According to the answer and to the C standard if I try to assign, for example, a signed long to a ...
0
votes
0
answers
402
views
I have a snake game that runs on c code and i want to see if there are ways to make it more accessable on different compilers
For a class project, my group made a snake game that runs on C code, but it uses libraries that aren't standard. Is there any way to make the game run on more platforms besides the one I'm using, ...
-3
votes
1
answer
498
views
How to run a portable Jar-File in Java 20 (OpenJDK 20)
I would like to run a portable jar-file created with OpenJDK 20 (i.e. without installation).
So far I have managed this with the OpenJDKJRE package for Java 14 from portableapps.com. But for the ...
2
votes
0
answers
273
views
Portable Visual Studio Code on mac not working
I want to create my portable Visual Studio on my USB key with MacOS. I followed the instruction from the official site:
On macOS, you need to place the data folder as a sibling of the application ...
2
votes
1
answer
187
views
Emulating a packed structure in portable C
I have the following structure:
typedef struct Octree {
uint64_t *data;
uint8_t alignas(8) alloc;
uint8_t dataalloc;
uint16_t size, datasize, node0;
// Node8 is a union type with ...
1
vote
0
answers
41
views
How are library dependencies managed in practice, in a self-contained/portable app?
I'm not an experienced programmer and I'm mostly self taught. I never really learned how to manage dependencies and I'm having some trouble finding the information I need, which I think it's pretty ...
0
votes
0
answers
264
views
How can I port GCC to a new Operating System?
I want to port Gcc to a new Operating System. Because I want to compile C++ code on the System. But I don't know how to start.
Should I just copy the source code of Gcc to the Operating System's and ...
0
votes
0
answers
249
views
How to prevent incorrect clang-tidy:readability-redundant-string-cstr detection? [duplicate]
Here is the typical (pseudo) code I wish to handle in clang-tidy (eg also here) for conveying an optionally null terminated fixed size buffer to std::string:
% cat str.cc
#include <iostream>
#...
0
votes
1
answer
106
views
AND + CMP or SHR + CMP?
I’m wondering what’ll result in overall “better” code (if speed’s equal then compactness): AND-and-CMP…
#define is_foo(someuint) ((someuint & (unsigned int)~0x7FU) == 0x001B0080U)
… or SHR-and-...
3
votes
0
answers
222
views
unique_ptr in PImpl and ABI compatibility
Consider a standard class implementation that makes use of PImpl, but uses a std::unique_ptr to manage the implementation object's lifetime:
class MyClass {
public:
class Impl;
MyClass();
...
0
votes
0
answers
275
views
Unicode box drawing characters in a portable C program
I'm trying to use Unicode box drawing characters in a C program that is intended to be portable across a range of operating systems, C compilers and environments. Example:
#include <stdio.h>
#...
1
vote
1
answer
200
views
It's possible to make a source code 32 or 64 bit only?
As my understanding, I can compile my C code into 32bit binary or 64bit easily, but, some open source projects sais "We don't support 32bit CPU", so why? what makes the code source 64bit ...
1
vote
2
answers
112
views
Are exact-width integers in Cython actually platform dependent?
In Cython one can use exact-width integral types by importing them from stdint, e.g.
from libc.stdint cimport int32_t
Looking through stdint.pxd, we see that int32_t is defined as
cdef extern from &...
0
votes
1
answer
1k
views
How do I add my portable MinGW as a compiler in my portable VS Code?
I have a portable version of VS Code on a USB stick as well as a copy of MinGW. But when i try to run a c file on VS Code, the MinGW copy on the USB stick does not show up as an option when running (...
4
votes
1
answer
707
views
Portable way to write Python 3 shebang?
Back when Python3 was there, I used to use:
#!/usr/bin/env python3
But recently, especially with Ubuntu 22.04 or macOS, the python3 executable isn't always available in PATH, instead, I should use ...
1
vote
0
answers
540
views
using miktex portable INSTEAD of system wide installation with VSCode
I would like to create an USB-Stick you can put into any windows with VSCode, miktex (and perl) portable to work on my thesis with any win device.
VSCode and perl are working just fine and miktex ...
0
votes
1
answer
2k
views
Python virtualenv with relative paths
I would like to install a python virtualenv with relative paths, so that I can move the virtualenv to another machine (that has the same operative systems).
I googled about a solution, some suggests ...
7
votes
1
answer
2k
views
what is the standard for password hash string encoding?
I'm asking about the format used after the password is hashed and preparing it for storage. The dollar sign $ annotation is something that seems to be widespread. Is that described in a standard ...
0
votes
1
answer
468
views
What guarantees does C provide about enum ordinal values
When I convert enum to integer type, what can I expect?
Does the first variant have value of 0?
Does the variant ordinal number increment by 1?
Assume that I did not explicitly provide the values.
...
7
votes
1
answer
174
views
Is checking the location of the sign bit enough to determine endianness of IEEE-754 float with respect to integer endianness?
I recently wrote some code that uses memcpy to unpack float/double to unsigned integers of the appropriate width, and then uses some bit-shifting to separate the sign bit from the combined significand/...
1
vote
2
answers
109
views
c++ portable address encoding
I'm writing a software that, at some point must write internal addresses into a buffer. I wrote the following code which works. But produce warnings when cross-compiling to a target device with an ...
3
votes
1
answer
321
views
Portable way of checking if *some* user exists in either Linux or Windows?
I need to check if a user exists in either Linux or Windows, using Python 3 (3.7 right now for reasons unrelated).
No, pwd doesn't work on Windows.
No, getpass only returns current username, while I ...
2
votes
3
answers
1k
views
c++ 17 std::filesystem can not run on other (windows 10) computer
I have a program, compiled using MinGW on and for windows 10, I want this program to run on other peoples computers, even if they do not have MinGW or any c++ compilers installed.
Normally, this is ...
0
votes
1
answer
2k
views
Portable way to check if subprocess exit code indicates a success?
I'm looking for a portable way to check whether a subprocess exited with an exit code indicating a success.
I found out that some systems don't follow the standard convention of 0 meaning "...
0
votes
0
answers
121
views
Portable method in C++ to determine special folder locations (Downloads, Documents, Preferences, etc.)
I've been searching for a portable method in Boost or C++17 std::filesystem (or POSIX) to determine the system sanctioned locations of the user's Documents, Downloads, and Preferences. Do these ...
1
vote
1
answer
3k
views
How to know if a .jar built on AMD64 will run flawlessly on ARM?
I built a .jar in docker on the ARM architecture and one on AMD64.
The two .jar files have the identical size, but vbindiff says their contents are quite different.
I tested both .jar files on my ...
0
votes
0
answers
215
views
How can I use a RN lib in Flutter?
I have a React Native library that needs to be used in a flutter project, is there a way for me to use it? (I have 0 skill in flutter)
Thanks in advance!
1
vote
2
answers
71
views
Reliably and portably store and retrieve objects of structure type in C
@bdonlan,in Copying structure in C with assignment instead of memcpy(), lists several reasons for using memcpy to copy objects of structure type. I have one more reason: I want to use the same area of ...
1
vote
1
answer
601
views
How to create a portable C/C++ program on linux using additional libraries?
I need to create a portable linux program that uses a lot of additional libraries defined from yum (CentOS).
It is forbidden to install new packages on portable machines. There are no necessary ...