Tumgik
#iec
fingors · 1 year
Text
C — The Way It’s Written — Types
This is the first part in a possibly multi-part series of posts about the C programming language. It’s based not on common examples or what you’ll see your particular C compiler output, but on what’s written in the actual standard(s) that define the language. That being ISO/IEC 9899, in particular the 2018 revision (often named C17 or C18), however due to upcoming significant changes in the next revision (C2X), I’ll be skipping over a couple bits here and there that will be deprecated or removed by said revision, I’ll also revert to older versions if needed for special cases. All that being said, unless stated otherwise these posts are about C17. This series also assumes a baseline level familiarity with programming in general and expects you to know the general syntax style of C (if you’ve written or read and C++, Java, C#, or any similar language you’re good).
Due to the nature of C17 being an ISO/IEC document, it is not freely available for download, however the final working draft version of it is freely available, and there should be no significant changes between it and final. Link here.
Now, in what might seem like a very odd choice, we’re going to instantly skip to section 6 of the standard, not only that we’re skipping directly to 6.2.5 (page 31), because this is what defines the fundamental types of the language. Paragraphs 2, 4 and 6 are the important ones right now. From 2 we learn that the type _Bool (just bool in C2X) is at least large enough to hold the values 0 or 1 (hence its name, bool, short for boolean). Then we come to paragraph 4, which states there are 5 standard signed integer types: char, short, int, long, and long long (there’s also a statement about extended types but that can be ignored for the moment). Finally we hit paragraph 6, which simply states that all signed integer types have an unsigned equivalent that can be written by simply attaching the word unsigned to one of the types (ex. unsigned int), and that these 5 unsigned types combined with _Bool make up the set of unsigned types, and that any unsigned type takes up the same amount of storage/memory space as its corresponding signed type.
Moving back slightly to paragraph 5 we learn that signed char and char take the same amount of memory (and as such so does unsigned char), it also states that the int type should be the natural operating size of whatever machine architecture the code is being written for (so long as it satisfies a minimum value requirement). Moving forward to paragraph 9 we learn that, as you would expect, the signed types can store negative and positive values, and that the unsigned types can only store positive (or zero) values. We also learn that by definition unsigned values can not overflow, instead their value simply wraps around the range, however this is often referred to as overflow regardless.
Yet further down (paragraph 15, next page) we learn that char, signed char, and unsigned char are all different types, however char must match either char or unsigned char (the reasoning for this is that a compiler is free to choose the most efficient match for processing).
So with all that jumble out of the way what did we actually learn? Well: there exist 5 fundamental integer types: char, short, int, long, and long long, and that signed and unsigned versions of each exist, we also know there’s an unsigned type, _Bool that can represent the values 0 and 1. Together these make up the integer types of C.
Beyond integers there’s also floating point types, float, double, and long double, but those are a much more complicated subject that are outside the scope of this post. There’s also the void type, which has confusing wording that basically boils down to “you can’t use this, it represents nothing” (which is why functions with no return value have their return type marked void). And finally that you can make arrays out of these types (except void), make structure types that contain any number of these types (except void), make union types (complicated subject, think a box that can store only one type (except void) at a time), you can declare functions that return any type, you can have a pointer to any type (including void in order to represent a pointer to an unknown type), and finally that any type can be made atomic (safe for access from multiple threads).
Most of that statement can be freely ignored for now, it’s a mess that we’ll (hopefully) get into later. The important bit to know is that you can build other types out of the fundamental types.
Moving beyond that section and into 6.2.6 we learn from 6.2.6.1 Paragraphs 2-4 that objects (any type’s representation in memory basically) is made out of a continuous sequence of bytes. Moving to 6.2.6.2 we get to the representation of integer types, which is pretty much what you would expect for unsigned values (an unsigned integer of size n value bits can store 2n values from 0 to 2n-1), signed integer types in C17 list three different representations, however C2X is reducing that down to just twos’ complement (a signed integer of size n bits can store from -2n-1 to 2n-1-1, negative zeros are not possible).
So far: there exist integer types, and these store values in the expected way, but what are the range of values they must store?
Section 5.2.4.2.1 (page 20), paragraph 1 states that all implementations of the language must have the integer types be able to represent at least the values in the ranges listed below, meaning an implementation is free to expand the range if it sees fit (like how many do with int). From here we learn that a char must be at least 8 bits, and as such a signed char must be able to represent -127 (-128 in twos’ complement) to 127, and that an unsigned char is 0 to 255. Helpfully the actual (minimum) number of bits for each type is specified in a comment next to the definition. short is 16 bits/2 bytes, int is also 16 bits/2 bytes (again often expanded to 32 bits/4 bytes), long is 32 bits/4 bytes, and long long is 64 bits/8 bytes. _Bool due to its nature as a boolean type is not mentioned (actually any values placed into an object of type _Bool will become 0 if the value is 0 or 1 otherwise).
In summary: 6 types, _Bool (0 or 1), char (at least 8 bits), short (at least 16 bits), int (at least 16 bits, often 32), long (at least 32 bits), and long long (at least 64 bits).
So that’s it? For now yeah, those are the basic integer types of the C programming language, I know it was messy and weirdly formatted and confusing at times but I hope it helps understand the language a bit more, or at the very least was entertaining (even if that entertainment derived from “what the hell is this language?”). However, these complexities are part of the reason I love this language so much, everything is well defined but still variable depending on the system and compiler, there’s a reason for everything in this language ranging anywhere from “old” to “for performance reasons we can’t mandate this”, which if this series continues we’ll really get into. But for now, I hope this was enough of a taste of the standard to either make you interested in seeing more, or scare you the hell away forever. Thank you for reading and have a good time. If you have any suggestions for future parts or ways I could improve these writings please inform me. I need to go to sleep now.
40 notes · View notes
education12100 · 1 year
Text
IEC COLLEGE GREATER NOIDA REVIEW 2023 | Complete Details
youtube
Looking for a comprehensive review of IEC College Greater Noida? Look no further! In this video, we provide a detailed overview of the college, including its programs, facilities, faculty, and student life. Whether you're considering applying to IEC College or simply curious about what it's like to study there, this review has everything you need to know. Join us as we explore the campus and talk to current students about their experiences. Don't miss out on this informative and insightful look at IEC College Greater Noida!
2 notes · View notes
ofinblog · 1 year
Text
Tumblr media
Importer Exporter Code (IEC) is a key business identification number which is mandatory for Imports or Exports. No person shall import or export except under the IEC number allotted by the Directorate General of Foreign Trade (DGFT). An importer or exporter needs the IE Code and GST Registration to clear the Goods from the customs. Therefore it is mandatory to obtain Importer Exporter Code to start import or export business.
2 notes · View notes
labrecha · 3 days
Text
Poco Interés Ciudadano en los Debates del IEC
#Elecciones2024 Poco Interés Ciudadano en los Debates del #IEC
Escenario para el debate en Torreón. Coahuila de Zaragoza / Abril 23 de 2024.- Es notorio el poco interés de la ciudadanía en escuchar o ver los debates, son dos los que ha celebrado el Instituto Electoral de Coahuila, uno en Saltillo y el otro este domingo pasado en Torreón; una consulta popular, informal, entre 50 ciudadanos, mencionó no tener algún interés en presenciarlos, “son aburridos”,…
Tumblr media
View On WordPress
0 notes
unitedtesting · 7 days
Text
Tumblr media
What is the IEC report?
The IEC report is a product test and evaluation report issued by an international Electrotechnical Commission (IEC) accredited laboratory or a third party organization.
As a global international organization for standardization, IEC has developed international technical standards widely applicable to electrical, electronics and related technologies.
In addition to assisting in the promotion of global trade and technical exchanges, the IEC report certifies that the products adhere to these international standards to guarantee their quality, safety, and environmental protection.
IEC product range: Electrical equipment, motors, electronics, power, microelectronics, communication, audio-visual, robotics, information technology, new medical devices, and nuclear instruments are all included in IEC's field of expertise.
1 note · View note
alishajoy059 · 17 days
Text
Tumblr media
In India, various business registrations like GST, PAN, and TAN are essential. Additional approvals from SEBI, RBI, FSSAI, and other authorities may be needed based on business activities. Compliance ensures smooth operations and legal adherence, promoting ease of doing business.
0 notes
apnagst01 · 26 days
Text
IEC Registration Service in Delhi
Looking for IEC Registration Service in Delhi? ApnaGST offers seamless solutions for quick approvals. Start your global trade journey today with a click!
Tumblr media
0 notes
plglobal · 1 month
Text
Tumblr media
Unsure about import export code registration? This guide makes it easy. Learn about IEC code registration, its benefits, how to apply online, and why import & export services are crucial. Get going on your import/export journey today!
0 notes
Text
Importer Exporter Code Registration in Belagavi
The Import Export Code (IEC) is an essential business identification number required for both imports into and exports from Belagavi, India. It is issued by the Directorate General of Foreign Trade (DGFT) to facilitate foreign trade operations in the region. Without IEC registration, the import or export of goods in Belagavi is not permitted.
Documents required for Importer Exporter Code Registration
.PAN card copy of the applicant entity.
.Address proof of the company( Electricity Bill)
.Lease/Rental Agreement if the office is rented.
.Canceled Cheque copy of company’s current bank             account.
.Sale deed if the company is self-owned.
.Digital Photograph(3*3)
0 notes
iec-college · 2 months
Text
Tumblr media
IEC College of Engineering & Technology providing 2 crore Scholarship to know more visit our website https://iec.edu.in
1 note · View note
fingors · 1 year
Text
C — The Way It’s Written — Ranks & Bytes
This is part 2 in a series of posts about the C programing language, part 1 (and series details) can be found here
Well everyone, I hope you kept your copy of the free version of the standard from last time, 'cause that thing isn't going away any time soon. To give a quick rundown on what this part is going to cover, it's going to cover the rank of integer types, and it's going to go over the definition of a byte in the language and some of its consequences.
Rank
The “integer conversion rank” (6.3.1.1 p1, page 37) is a scale (or ranking) of all the integer types from _Bool to unsigned long long (and possibly implementation defined types). The definition effectively states that all integers have some rank, that the signed and unsigned version of a type have the same rank (and char’s rank equals that of its signed and unsigned versions), that a type with a greater precision (number of bits) will always have a greater rank than a lower one, and that even if two types have the same representation (ie. same width) one will always have a greater rank. It also gives us an outline of the rank of the fundamental (called the “standard integer types” in the document) integer types: _Bool, char, short, int, long, and long long, and it also handily gives us the info that any implementation defined types (such as say __int64) has a rank less than a corresponding standard type with the same rank (such as (possibly) long long). It also states that any implementation defined types with the same precision have some ranking between each other, this is important because it establishes a total order (any integer type’s rank is either less than or greater than any other type).
So what’s the deal with ranks? Well notice the full title contains “conversion”, ranks are very important for determining integer type promotion. Any type who’s precision (and as such rank) is less than an int will be transformed into an int (if its value would fit, unsigned int otherwise) when performing an arithmetic operation (add, sub, mul, div), a shift operation, a ‘sign’ operation (negation (- operator) or the + operator), or when passed “certain argument expressions” (usually var arg functions). Note this is simply a promotion in width only, the values contained within remain completely unchanged. What this means is that adding a char to a char will in fact actually become the addition of an int and an int.
Ranks are also very important for another conversion, arithmetic operations on differing types (6.3.1.8 p1, page 39). Firstly if one of the types in the expression is a floating point type long double, double, or float) then the other type is promoted to that floating point type (you don’t want to lose the fractional part just cause you added an int after all), but after that is where rank becomes important. If the types are the same nothing happens and the expression goes on as usual, but if the types differ then the type with the lower rank is promoted to the type with the higher rank (usually, there’s a caveat about precision that basically boils down to “if promoting it would cause signed data loss, then promote both types to an unsigned version”). What’s all this mean? Well it basically means that given any two types (say int and unsigned long long) any operation between them will cause the lower rank type to become the higher rank type (here the int becomes an unsigned long long).
These results are all bound to the definition of conversion (6.3.1.3, page 38). Long story short on that if you convert a signed type to an unsigned type then the value stored will have 2n (where n is the value bit width of the new type) added to it over and over until the result falls within range of the new type, however if you convert an unsigned type to a signed type and the value can not fit within the signed type its up to the implementation what happens (since its implementation defined it must be documented somewhere). Conversion also comes into play in a few other places, like assigning values of one type to another (ex. char to int) or passing arguments to functions (ex. passing an int value to a function expecting long).
Byte(s)
Ok this one is going to be a lot simpler (and more fundamental) than ranks, I’ve only put it after type introduction and ranks because it's easier to understand that way (at least for me, sorry if you find it otherwise).
Alright let’s get the big things out of the way first, a byte is simply defined as “addressable unit of data storage large enough to hold any member of the basic character set of the execution environment” (3.6, page 4), which just means it can hold all of the basic ASCII (printable) characters excluding ‘`’ (the backtick), ‘$’ and ‘@’ as well as some control characters like new lines and such. The other big thing is that a byte is at least 8 bits (5.2.4.2.1 p1, page 20), but can be more (there have been systems with 9 bit bytes before), and also that a char (and signed and unsigned versions) are exactly one byte, no more, no less.
The other thing is that any (non-bitfield) object (an object in C is defined in section 3 and is simply the value contained within some memory location) is composed of n continuous bytes (6.2.6.1 p4, page 34), meaning that the total width of the object in bytes is n multiplied by the number of bits in a byte. It also goes on to detail that any objects with the same bit pattern (except for floating point NaN values) will compare as equal, however not all objects that compare equal need to have the same bit pattern (ex. negative 0 and ‘normal’ 0).
Further down (6.2.6.2) we learn that any integer type (except unsigned char which is only value bits) can be divided into value bits (bits that contribute to the actual value of the number) and padding bits (bits that are just there to make the integer fill the full width of a n bytes), and that there need not be any padding bits. As expected an unsigned type can store any value between 0 and 2v-1, where v is the number of value bits, and a signed type can store between (at least) -2v-1 and 2v-1-1 (due to needing a sign bit).
All other objects have n bytes contained within them, however their usage of the bits will differ greatly depending on their use, for example floating point types need to divide their bits between sign, exponent, and mantissa, and structs use their bytes to hold other types and objects.
Conclusion
So that’s it, that’s ranks and bytes in the C programming language. Ranks determine how integer types combine together, and bytes make up every object in the language and determine their value.
Thank you for reading, once again I stayed up late to write this, except it's even worse since I have something critical tomorrow. If you have any comments, concerns, or ways to improve this series drop them in the replies.
4 notes · View notes
azania-south-africa · 3 months
Text
Tumblr media Tumblr media
Take a stand and register to vote
South Africa is fairly a new nation, only 30 years old as a newly free and democratic country and as a republic.
Coming from a long and dark history of conquest, colonization, and apartheid it took centuries for our country to attain freedom and the right to self-determination.
Today, we live in a society that has been greatly impacted by these periods of oppression. To this day, a just and equal society has not been achieved because of the vast differences in economic power of the citizens and access thereof to resources that would result in the attainment of economic freedom.
Our families who participated in the struggle for freedom did want us to be mere cogs in the economic machine but wanted us to be owners and creators, to be in charge of our own destiny.
We today hold the power to achieve this, we can participate in the general elections to vote for the direction we want our country to take, if we don't participate then the country will not serve us as we wish.
Registering to vote is a way to have a say in this country. Governments should serve its citizens and create economic opportunities for its citizens, a government that is corrupt, thieving, lacking integrity and leadership won't get us there.
We need to take a stand and fight for our country in the same spirit that our elders had. We are the future and no one can stop us. We want change and will be at the forefront advocating and building for it.
If nothing changes nothing changes therefore we will do whatever it takes to change our situation and voting 🗳 is a step in the right direction let's remove the former liberation movement from absolute power.
Tumblr media
1 note · View note
ssaberiec · 3 months
Text
this school sucks and it feels like i’m on my own and unknown
0 notes
labrecha · 5 days
Text
Otro Debate Suavecito del IEC en Torreón
#Elecciones2024 Otro Debate Suavecito del #IEC en #Torreón. Román Alberto Cepeda se dijo ganador.
Debate de candidatos a la Presidencia Municipal de Torreón. ** Román Alberto Cepeda se dijo ganador del debate celebrado este domingo a las 18:00 horas en el Hotel Crowne Plaza de Torreón. Torreón, Coahuila, Abril 21 de 2024.- Con un formato plano, que evitó réplicas entre candidatos, el Instituto Electoral de Coahuila celebró el segundo debate de Ayuntamientos del Proceso Electoral 2024, donde…
Tumblr media
View On WordPress
0 notes
syscomme · 4 months
Text
Benefits of Implementing IEC 62443
Benefits of Implementing IEC 62443:Robust Cybersecurity: IEC 62443 provides a systematic approach to cybersecurity, helping organizations establish effective measures to protect IACS from cyber threats. This includes preventing unauthorized access, data breaches, and system disruptions.Enhanced Resilience: By following the standard's guidelines, organizations can improve the resilience of their IACS against cyber incidents. This enables faster recovery and minimizes the impact of potential cybersecurity breaches.Regulatory Compliance: Implementing IEC 62443 helps organizations meet regulatory requirements and industry standards related to cybersecurity in critical infrastructures, such as power plants, chemical facilities, and transportation systems.Risk Mitigation: The standard facilitates a proactive approach to risk management by identifying and addressing vulnerabilities and threats in IACS. This reduces the likelihood of successful cyber attacks and their potential consequences.Trust and Reputation: Following IEC 62443 demonstrates a commitment to cybersecurity and can enhance the trust and reputation of organizations operating critical infrastructures. This can be crucial in building customer confidence and maintaining business continuity.
0 notes
accteezindia · 5 months
Text
🌟 Your Success, Our Pride! 🎥✨ Immerse yourself in the AccTeez journey through our review video. Clients share their stories of triumph, featuring services like GST Registration, FSSAI, Private Limited Company Registration, and more. Your trust empowers us. Connect with us for excellence in every aspect of your business.
📋 Contact us: +91-8860632015
1 note · View note