Click here to Skip to main content
15,920,688 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Can someone show me an example of including a DLL or function in a C program ? Pin
Richard MacCutchan17-May-18 21:40
mveRichard MacCutchan17-May-18 21:40 
AnswerRe: Can someone show me an example of including a DLL or function in a C program ? Pin
leon de boer18-May-18 8:58
leon de boer18-May-18 8:58 
Questionvolatile misbehaves Pin
Vaclav_17-May-18 3:19
Vaclav_17-May-18 3:19 
AnswerRe: volatile misbehaves Pin
Richard MacCutchan17-May-18 4:04
mveRichard MacCutchan17-May-18 4:04 
GeneralRe: volatile misbehaves Pin
Vaclav_17-May-18 4:26
Vaclav_17-May-18 4:26 
GeneralRe: volatile misbehaves Pin
Richard MacCutchan17-May-18 4:42
mveRichard MacCutchan17-May-18 4:42 
GeneralRe: volatile misbehaves Pin
Vaclav_17-May-18 5:39
Vaclav_17-May-18 5:39 
GeneralRe: volatile misbehaves Pin
supercat930-May-18 12:20
supercat930-May-18 12:20 
Vaclav_ wrote:
Here is something which MAY explain the issue.

https://gcc.gnu.org/onlinedocs/gcc/Volatiles.html


I don't think that's the issue here, but it does represent something I wish the Standard would address. Although there may be some platforms and application fields for which gcc's behavior would be reasonable in a quality compiler, there are many purposes for which it is not. On many platforms, it is possible for an access to a volatile location to trigger operations that usefully affect other storage (e.g. starting an "in-place" background I/O operation). For an implementation to be suitable for systems-programming on such a platform, it must provide a way of ensuring that such operations are sequenced relative to other operations on non-qualified storage. An implementation can support systems programmings on such platforms without requiring the use of special directives by treating volatile accesses as triggering a call to an unknown function, and I would suggest that quality implementations for such platforms should provide an option to treat them in such fashion.

Unfortunately, even though the Standard has to date expressly avoided quality-of-implementation issues, the authors of gcc seem to think either that the Standard fully describes everything necessary to make something a quality implementation, or that users should not expect gcc to behave like a quality implementation when any of its optimizations are enabled.

While there might some cases where it might be unnecessarily expensive to treat volatile accesses as sequenced relative to non-qualified accesses to objects that would be accessible by outside code, in most cases the cost would be negligible, and would be less than the cost of adding "volatile" qualifiers and accesses everywhere else that would otherwise be necessary to ensure correct semantics.

When the Standard was written, it may have been reasonable to expect compiler writers to exercise good judgment about how quality compilers intended for various purposes should be expected to behave in circumstances beyond those mandated by the Standard, and for programmers to be reliant upon compiler writers' sound judgment. Such expectation and reliance are no longer tenable. If the authors of the Standard don't want to mandate that all compilers treat "volatile" more strongly, they should at minimum specify a predefined macro to allow programmers to say something like:
#if !(__STDC_VOLATILE_SEMANTICS >= 3)
#error "This compiler, as configured, cannot handle the necessary volatile semantics."
#endif

and then expect that every compiler will either process their code with required semantics or refuse to process it altogether. Compiler writers that find such semantics impractical would not be required to support them, but would merely be required to refrain from defining __STDC_VOLATILE_SEMANTICS with a value indicating such support. Code which includes the above test and relies on such semantics would be less portable than code which does neither, but its behavior would be defined on all systems which process it.
AnswerRe: volatile misbehaves Pin
Joe Woodbury17-May-18 5:48
professionalJoe Woodbury17-May-18 5:48 
GeneralRe: volatile misbehaves Pin
Vaclav_17-May-18 6:04
Vaclav_17-May-18 6:04 
GeneralRe: volatile misbehaves Pin
Vaclav_17-May-18 7:24
Vaclav_17-May-18 7:24 
AnswerRe: volatile misbehaves Pin
leon de boer18-May-18 8:16
leon de boer18-May-18 8:16 
GeneralRe: volatile misbehaves Pin
Vaclav_19-May-18 14:02
Vaclav_19-May-18 14:02 
GeneralRe: volatile misbehaves Pin
Vaclav_19-May-18 14:36
Vaclav_19-May-18 14:36 
GeneralRe: volatile misbehaves Pin
leon de boer20-May-18 4:41
leon de boer20-May-18 4:41 
GeneralRe: volatile misbehaves Pin
Vaclav_20-May-18 5:44
Vaclav_20-May-18 5:44 
GeneralRe: volatile misbehaves Pin
leon de boer20-May-18 20:35
leon de boer20-May-18 20:35 
GeneralRe: volatile misbehaves Pin
Vaclav_21-May-18 3:18
Vaclav_21-May-18 3:18 
GeneralRe: volatile misbehaves Pin
leon de boer21-May-18 4:33
leon de boer21-May-18 4:33 
Question__sync_synchronize stops processor ? Pin
Vaclav_16-May-18 10:31
Vaclav_16-May-18 10:31 
AnswerRe: __sync_synchronize stops processor ? Pin
Randor 16-May-18 12:15
professional Randor 16-May-18 12:15 
GeneralRe: __sync_synchronize stops processor ? Pin
Vaclav_16-May-18 13:15
Vaclav_16-May-18 13:15 
GeneralRe: __sync_synchronize stops processor ? Pin
Randor 16-May-18 14:10
professional Randor 16-May-18 14:10 
GeneralRe: __sync_synchronize stops processor ? Pin
Vaclav_17-May-18 3:22
Vaclav_17-May-18 3:22 
QuestionTo install Visual Studio(2008 Pro,2010 Express and 2013 Express) in the same machine Pin
manoharbalu14-May-18 19:30
manoharbalu14-May-18 19:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.