Questions tagged [pragma]

The #pragma directives offer a way for each compiler to offer machine- and operating system-specific features while retaining overall compatibility with the C and C++ languages.

Each implementation of C and C++ supports some features unique to its host machine or operating system. Some programs, for instance, need to exercise precise control over the memory areas where data is placed or to control the way certain functions receive parameters. The #pragma directives offer a way for each compiler to offer machine- and operating system-specific features while retaining overall compatibility with the C and C++ languages. Pragmas are machine- or operating system-specific by definition, and are usually different for every compiler.

From MSDN

761 questions
0
votes
2 answers

Pragma use in across dll

I have a main Program A which calls a dllB method. dllB is build in release mode. Depending on which mode the Program A is build(Release/Debug) the result should be returned appropriately but it always returns "releaseMode". So is there a way where…
Mangesh
  • 3,987
  • 2
  • 31
  • 52
0
votes
0 answers

Applying Pre-fetching in this C++ code for finding maximum value index

The following code finds min/max and its location in a given array: //Finding the array index// #include "stdafx.h" #include #include #include #include using namespace std; int main () { int A[4] =…
gpuguy
  • 4,607
  • 17
  • 67
  • 125
0
votes
1 answer

Remove warning when using newer SDK version method

I'm using a method that is available since the version 5.0 of the iOS SDK. Of course before calling it, I'm checking whether or not the class has the method (in other word it is checking the iOS version that is running) : if ([UITabBar…
Vincent
  • 1,013
  • 14
  • 33
-1
votes
1 answer

Problem with outer loop vectorization using OpenMP in C

I am lerning how to use OpenMP to make a code use muttiple processors. Recently, I tried to make my Ewald Summation Fourier part parallel using OpenMP. Below is the function named PME_fourier_oprimized which I try to make parallel using OpenMP…
Seth
  • 3
  • 2
-1
votes
1 answer

How to mark a code section with a warning purposely in C#?

is it possible to for example use #pragma to raise a custom warning within the VS IDE? I'd need it for a while because there are two classes in this code that contain the very same data but derive from very different classes (Attribute, EventArgs).…
CarstenP
  • 241
  • 1
  • 2
  • 8
-1
votes
2 answers

How do I implement this algorithm in C++ using OpenMP, or in which application can I implement it?

How do I implement Sum_EREW algorithm in C++ using OpenMP, or in which application can I implement it? for i = 1 to log (n) do forall j where 1 <= j <= n/2 do in parallel if (2j modulo 2**i) = 0 then A[2j] <-…
Hole Whel
  • 1
  • 2
-1
votes
1 answer

trying to parallelize my code however when I run it, it never gives the correct output

I have a program that initializes a vector of 1,000,000 size and then finds all the prime numbers in it. The primes are stored in a new vector, I then iterate through that vector and try to find all of the happy numbers in it. I am trying to use…
-1
votes
1 answer

How do you get the number of columns in a SQLite File using PRAGMA?

I've tried using pragma table_info(test001) however that just returns another table where there's a row for every column. My issue is that, how do I count the rows? I've tried using SELECT COUNT(*) FROM PRAGMA table_info(test001) and SELECT…
slam505
  • 13
  • 8
-1
votes
1 answer

Strange behavior of #pragma pack

I am facing a strange issue when using #pragma pack. I have the following structs: st_a: packed with #pragma pack(1). Size = 1 byte. Contains bitfields. st_b: packed with #pragma pack(2). Size = 14 bytes. st_c: packed with #pragma pack(2). Size =…
kiner_shah
  • 3,939
  • 7
  • 23
  • 37
-1
votes
1 answer

expected, got '?'

Android Studio 3.1 purpose: update version number of sqlite database error expected, got '?' the code caused error was db.execSQL("PRAGMA user_version = ?", new Object[]{questionDbVersion}); android.database.sqlite.SQLiteException: near "?":…
Jack Wilson
  • 6,065
  • 12
  • 29
  • 52
-1
votes
1 answer

How to set sqlite3 default "pragma secure_delete=true" without compile on windows 10 home

I have sqlite3 version 3.15.2 on a Windows 10 home laptop. What I need/want is the same thing, but with the pragma secure_delete set to true so it applies to every database I use, but I can't compile sqlite3. Secure_delete just writes 0s into the…
Marichyasana
  • 2,966
  • 1
  • 19
  • 20
-1
votes
1 answer

List ranking implementation in C with OpenMP -- Output error

The following code shows my implementation of list ranking algorithm with OpenMP. When I execute this code without the pragmas I get the correct results, but when I include the pragmas, I get errors (occasionally) in the output. The outputs are…
kumar
  • 9
  • 3
-1
votes
2 answers

What is the purpose of #pragma aux and how should I use it?

I'm attempting to delayload a library and use GetProcAddress to get a function from the library to use repeatedly. The project I'm working on has examples of how this being done in other cases, and in the header file that describes typedefs of the…
cwuertz
  • 38
  • 7
-1
votes
1 answer

VS 2010 - #pragma comment (lib, XX) works, Additional Dependencies doesn't. Why?

It seems that no matter what I do, I can't get the Additional Dependencies to properly link my static library. This static library is created from another project I made. I've tried adding it as a reference, forcing project dependencies, double…
pantaryl
  • 155
  • 1
  • 10
-1
votes
1 answer

C++ error C2535 even though I'm using pragma once

I'm getting a weird C2535 Error when I run my code. It consists of a three main classes (summarized below). There are some circular dependencies between them but they are preceded by #pragma once macros and should not be created more than one time.…
CodyBugstein
  • 21,984
  • 61
  • 207
  • 363
1 2 3
50
51