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
-1
votes
2 answers

Why my C code is slower using OpenMP

I m trying to do multi-thread programming on CPU using OpenMP. I have lots of for loops which are good candidate to be parallel. I attached here a part of my code. when I use first #pragma omp parallel for reduction, my code is faster, but when I…
hadis
  • 9
  • 1
  • 4
-1
votes
4 answers

Subcategorize methods using #pragma

I'm working on an iOS Project, in which I'm using #pragma mark to arrange methods according to their respective category. My issue is that some categories have sub-categories. How can I arrange my methods to reflect method categories and their…
Midhun MP
  • 103,496
  • 31
  • 153
  • 200
-1
votes
1 answer

Where to put #prama warning preprocessor directive to suppress warnings?

I have many header files and source codes for my project in C++. I wanted to suppress warnings, therefore, came to know about #pragma warning preprocessor. I am able to suppress one kind of warning, namely 4251, by putting #pragma…
Sanchit
  • 3,180
  • 8
  • 37
  • 53
-2
votes
1 answer

Can you prevent the usage of #pragma warning disable?

Recently, our team has tried to become more strict about enforcing certain code style and quality guidelines. I'm trying to automate this as much as possible, using .editorconfig files to enforce certain rules--in many cases preventing a build…
erikjw
  • 45
  • 9
-2
votes
1 answer

C4996 'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS

I want to solve this problem without "#pragma warning (disable:4996)" please help me. I tried many things. I think it may have problem with visual studio.
-2
votes
1 answer

CS0642 isn't disabled when using #pragma disable

Is anyone else seeing the 642 warning not being caught by #pragma warning disable 642? Thanks, Also, why doesn't suppress work? ================================================================ To clarify, this is…
Lee Wood
  • 55
  • 7
-2
votes
1 answer

How to use Sqlite PRAGMA secure_delete on Android Java

Does someone have an example on how to use Pragma secure delete ? I need it for my Android app. I tried everything, but i always get an error.
Sin Tec
  • 21
  • 1
-2
votes
2 answers

How can #pragma be portablized?

Is it possible to portablize all #pragma commands? #pragma once can be portablize as the following: #ifndef FOO #define FOO //Code here #endif However, I am not aware of universal implementations for #pragma pack and others. Is this possible?
パスカル
  • 479
  • 4
  • 13
-3
votes
2 answers

Use of #pragma section in C

What is the use of #pragma section directive in C language ?
Fagun
  • 35
  • 8
-4
votes
1 answer

#pragma not working right in C?

my first time really working with #pragma and for some reason I don't get the same output as the ones posted online, the functions don't print out, I use GCC v5.3 and clang v. 3.7. Here's the code #include void School(); void College()…
JSamson
  • 31
  • 6
-4
votes
2 answers

Perl: How to predeclare a two-dimensional array?

After introducing: use strict; My 2-dimensional array do not work any more, and I find no description and no example in the documentation how to predeclare them. So, what have I to do?
ubuplex
  • 189
  • 1
  • 5
1 2 3
50
51