The ‘#pragma’ directive is the method specified by the C standard for providing additional information to the compiler, beyond what is conveyed in the language itself.
See also the _Pragma operator that is defined in newer versions of the C/C++ standards (and serves the same purpose, but with a slightly different syntax).
By using #pragma startup directive we can call the functions on startup before main function execution #include<stdio.h>. void print1() { printf("Before Main 1\n")
The pragma directive is used to access compiler-specific preprocessor extensions. A common use of #pragma is the #pragma once directive, which asks the...
CPragma. ... #pragma is used to do something implementation-specific in C, i.e. be pragmatic for the current context rather than ideologically dogmatic.
is a preprocessor directive in its own right; it can't be used within a
#define
directive.So, this is why
__pragma
exists: it provides a way for a pragma to be issued from wherever the macro that uses it is expanded.This is a non-standard compiler extension (MSVC, Intel, and some C compilers support it to varying degrees). See also the
_Pragma
operator that is defined in newer versions of the C/C++ standards (and serves the same purpose, but with a slightly different syntax).
23 Mayıs 2017
15 kişi değerlendirdi
1 yorum
{"2_1xr4":{"state":{"logo":{"href":"//yandex.com.tr","isForeign":true},"form":{"action":"/search/","searchLabel":"Bul","hiddenInputs":[{"name":"lr","value":21206}]},"actions":{"advancedSearch":{"checked":false,"ariaLabel":"Gelişmiş arama"},"moreButtonProps":{"ariaLabel":"Daha fazla"},"cbir":{"name":"cbir","label":"Поиск по картинке","infoUrl":"//yandex.ru/promo/photosearch/index?source=landingdesk","isMacOS":false}},"userSection":{"loggedIn":false,"loginProps":{"loginUrl":"https://passport.yandex.com.tr/auth?retpath=%2F&origin=serp_desktop_auth_new","loginText":"Giriş yap","burgerAriaLabel":"Menü"}},"navigation":{"tabs":[{"id":"www","label":"Arama","url":"//yandex.com.tr","params":{"source":"tabbar"},"target":""},{"id":"images","label":"Görsel","url":"//yandex.com.tr/gorsel/search","params":{"text":"[$query]","noreask":"[$noreask]","nomisspell":"[$nomisspell]","parent-reqid":"[$reqid]","from":"tabbar"}},{"id":"video","label":"Video","url":"//yandex.com.tr/video/search","params":{"text":"[$query]","parent-reqid":"[$reqid]","from":"tabbar"}},{"id":"maps","label":"Haritalar","url":"//yandex.com.tr/harita","params":{"text":"[$query]","source":"serp_navig"}},{"id":"translate","label":"Çeviri","url":"//ceviri.yandex.com.tr","params":{"text":"[$query]","from":"tabbar"}}],"selectedTabId":"www","fixedTabsCount":1},"context":{"query":"pragma c","reqid":"1720603231935616-15153394187106407660-balancer-l7leveler-kubr-yp-klg-122-BAL","noreask":"1","lr":"21206","counters":{"type":"b","data":{"$header":"0_7bwcz000","logo":"0_7bwcz001","login":"0_7bwcz003","usermenu":"0_7bwcz004","market-cart":"0_7bwcz006","more-button":"0_7bwcz007","cbir":"0_7bwcz008","$navigation":"0_7bwcz009","item":"0_7bwcz00i","tab-www":"0_7bwcz00b","tab-images":"0_7bwcz00d","tab-video":"0_7bwcz00f","tab-maps":"0_7bwcz00h","tab-translate":"0_7bwcz00j"}}},"loggedIn":false,"baobab":{"parentNode":{"context":{"genInfo":{"prefix":"0_7bwcw01-0-1"},"ui":"desktop","service":"web","reqid":"1720603231935616-15153394187106407660-balancer-l7leveler-kubr-yp-klg-122-BAL","fast":{"name":"header-desktop"}}}}},"type":"header-desktop"},"2_7bwc0":{"state":{"answersUrl":"https://stackoverflow.com/questions/23790112/what-is-pragma-and-what-are-the-differences-between-pragma-and-pragma#answers","type":"fact","tabsOptions":[{"id":"question","text":"Soru"},{"id":"bestAnswer","text":"En iyi yanıt"}],"tabContents":{"question":{"construct":[{"type":"paragraph","content":[{"type":"text","content":"The following macros confused me. I wondering what is __pragma and wwhat are the differences between __pragma and #pragma."}]},{"type":"code","content":[{"type":"text","content":[{"type":"text","color":"comment","content":"#define OPENVDB_START_THREADSAFE_STATIC_WRITE __pragma(warning(disable:1711))"}]},{"type":"text","content":[{"type":"text","color":"comment","content":"#define OPENVDB_FINISH_THREADSAFE_STATIC_WRITE __pragma(warning(default:1711))"}]}]}],"footerProps":{"date":1400679264,"numLiked":6,"numCommented":1}},"bestAnswer":{"construct":[{"type":"paragraph","content":[{"type":"code","content":[{"type":"text","content":"#pragma"}],"isInline":true},{"type":"text","content":" is a preprocessor directive in its own right; it can't be used within a "},{"type":"code","content":[{"type":"text","content":"#define"}],"isInline":true},{"type":"text","content":" directive."}]},{"type":"paragraph","content":[{"type":"text","content":"So, this is why "},{"type":"code","content":[{"type":"text","content":"__pragma"}],"isInline":true},{"type":"text","content":" exists: it provides a way for a pragma to be issued from wherever the macro that uses it is expanded."}]},{"type":"paragraph","content":[{"type":"text","content":"This is a non-standard compiler extension (MSVC, Intel, and some C compilers support it to varying degrees). See also the "},{"type":"code","content":[{"type":"text","content":"_Pragma"}],"isInline":true},{"type":"text","content":" operator"},{"type":"text","content":" that is defined in newer versions of the C/C++ standards (and serves the same purpose, but with a slightly different syntax)."}]}],"footerProps":{"date":1495531922,"numLiked":15,"numCommented":1}},"moreAnswers":[]},"organic":{"faviconProps":{"src":"https://favicon.yandex.net/favicon/v2/https://stackoverflow.com","size":"m","pageNumber":0,"index":0},"title":"What is __\u0007[pragma\u0007] and what are the differences between __\u0007[pragma\u0007] and #\u0007[pragma\u0007]","pathProps":{"items":[{"url":"https://stackoverflow.com/questions/23790112/what-is-pragma-and-what-are-the-differences-between-pragma-and-pragma","text":"stackoverflow.com"},{"url":"https://stackoverflow.com/questions/23790112/what-is-pragma-and-what-are-the-differences-between-pragma-and-pragma","text":"what-is-pragma-and-what-are-the-differences-between-pragma-and-pragma"}]},"faviconPosition":0,"subtitlePosition":1,"linkProps":{"url":"https://stackoverflow.com/questions/23790112/what-is-pragma-and-what-are-the-differences-between-pragma-and-pragma"},"hostTitle":"stackoverflow.com","description":""},"extralinksProps":{"hidden":true,"directions":["bottom-end"],"items":[{"variant":"reportFeedback","reportFeedback":{"feature":"Блок ответов для разработчиков","title":"Bu yanıtta yanlış olan nedir?","checkBoxLabels":[{"value":"Yanıt sorguya uygun değil"},{"value":"Yanıt hatalı"},{"value":"Yanıttaki bilgiler eksik"},{"value":"Diğer"}]}}]},"baobab":{"parentNode":{"context":{"genInfo":{"prefix":"2_7bwcw0c-0-1"},"ui":"desktop","service":"web","reqid":"1720603231935616-15153394187106407660-balancer-l7leveler-kubr-yp-klg-122-BAL","fast":{"name":"article"}}}}},"type":"article"},"2_7bwc1":{"state":{"linksGroups":[{"type":"geo","links":[{"label":"Columbus","title":"Columbus","url":"//yandex.com.tr/tune/geo","logNode":{"name":"region"},"target":"_self","a11yLabel":"Bölgeniz Columbus","needRetpath":true}]},{"type":"feedback","links":[{"label":"Hata bildir","logNode":{"name":"feedback","attrs":{"behaviour":{"type":"dynamic"}}}}]},{"type":"settings","links":[{"label":"Ayarlar","url":"//yandex.com.tr/tune/search","logNode":{"name":"settings"},"target":"_self","needRetpath":true}]},{"type":"company","links":[{"label":"Hakkımızda","url":"https://company.yandex.com.tr","logNode":{"name":"about"},"target":"_blank"},{"label":"Ticari teklifler","url":"/search/direct?text=pragma%20c&filters_docs=direct_cm","logNode":{"name":"commercial"},"target":"_blank"},{"label":"Kariyer","url":"//yandex.com.tr/jobs/?utm_source=serp_turkie&utm_medium=footerlink&utm_content=career","logNode":{"name":"vacancy"},"target":"_blank"},{"label":"Kullanım lisansı","url":"//yandex.com.tr/legal/termsofuse/","logNode":{"name":"license"},"target":"_blank"},{"label":"Gizlilik Politikası","url":"//yandex.com.tr/legal/confidential/","logNode":{"name":"confidential"},"target":"_blank"}],"a11yHidden":true}],"reportFeedbackProps":{"feature":"Подвал","title":"Hata bildir","checkBoxLabels":[]},"isSearchApp":false,"hasExtralinks":true,"limitingSelector":".AliceFabButton","baobab":{"parentNode":{"context":{"genInfo":{"prefix":"2_7bwcw0d-0-1"},"ui":"desktop","service":"web","reqid":"1720603231935616-15153394187106407660-balancer-l7leveler-kubr-yp-klg-122-BAL"}}}},"type":"serp-footer"},"2_7bwc2":{"state":{"conditionLoadList":{"marketCart":false,"highchartsHighstock":false,"advProductGallery":false,"musicPlayer":false,"ecomRates":false,"photoViewer":false,"darkmodeChangeDrawer":true},"reportFeedbackBaseProps":{"initEmail":"","metaFields":{"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","userTestids":"186144,124067,1056463,1053287,1052826,1051042,1046719,1010218,992985,754550,1048804,1056666,1053349,1060224,1054632,1056268,1052653,1052528,865544,1061275,1059329,936724,1055231,127805,1061215,1050023,1046932,1058495,1036351,1052192,1054081,1021617,1055459,1056357,133992,1053527,1057946,1056143,1053972,1053576,1060980,724556,724636,1046555,1037488,1056096,1011549,1044530,332148,1036614,1045240,151171,128378,126340,1055495,1054281,287509,86181,86183,1055644,338390,1006026,1057928,1055738,1036086,1043953,1050319,1054352,1046872,1053419,912284","yandexuid":"4256808091720603227","uid":"0","queryText":"pragma c","reqid":"1720603231935616-15153394187106407660-balancer-l7leveler-kubr-yp-klg-122-BAL","searchSlices":["drawer_search_slice_cs"],"userRegionName":"Columbus","userRegionId":"20815"}},"extralinksPopupProps":{"abuseLink":"https://twitter.yandex.com.tr/search/abuse?sign=c83c91c79c221ce0a3158a4c8eca3dfb&keyno=0"},"isLoggedIn":false,"userMenuDialogProps":{"flag":"skin,feedback","host":"yandex.com.tr","lang":"tr","project":"serp","queryParams":{"utm_source":"search"},"retpath":"https%3A%2F%2Ftwitter.yandex.com.tr%2Fsearch%2F%3Fes_context%3D0oYl8Q____________ARpLMTcxOTY2ODQ2OTg3NTY0My0xMjI1ODgwNjI2NzMyNjAzODc0Ni1iYWxhbmNlci1sN2xldmVsZXIta3Vici15cC1zYXMtODEtQkFMMgVhc3NvY-26GJ4%26lr%3D21206%26noreask%3D1%26rq%3D1%26serp-reload-from%3Drec_bottom%26text%3Dpragma%2Bc%26ncrnd%3D1412","tld":"com.tr"},"baobab":{"parentNode":{"context":{"genInfo":{"prefix":"2_7bwcw0e-0-1"},"ui":"desktop","service":"web","reqid":"1720603231935616-15153394187106407660-balancer-l7leveler-kubr-yp-klg-122-BAL","fast":{"name":"lazy-load"}}}}},"type":"lazy-load"}}