Changeset e330da6e in mainline for uspace


Ignore:
Timestamp:
2017-03-30T06:33:22Z (8 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
907d91a
Parents:
5b46ec8
git-author:
Supragya Raj <supragyaraj@…> (2017-03-30 06:33:22)
git-committer:
Jakub Jermar <jakub@…> (2017-03-30 06:33:22)
Message:

Add support for printing ptrdiff_t

Location:
uspace
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/tester/print/print2.c

    r5b46ec8 re330da6e  
    5353        TPRINTF("Real output:     [%#x] [%#5.3x] [%#-5.3x] [%#3.5x] [%#-3.5x]\n\n", 17, 18, 19, 20, 21);
    5454       
     55        char ch[12];
     56        ptrdiff_t d, neg_d;
     57       
     58        d = &ch[0] - &ch[12];
     59        neg_d = (unsigned)(-d);
     60        TPRINTF("Testing printf(\"%%td %%tu %%tx %%ti %%to\", d, neg_d, neg_d, d, neg_d):\n");
     61        TPRINTF("Expected output: [-12] [12] [c] [-12] [14]\n");
     62        TPRINTF("Real output:     [%td] [%tu] [%tx] [%ti] [%to]\n\n", d, neg_d, neg_d, d, neg_d);
     63       
    5564        return NULL;
    5665}
  • uspace/lib/c/generic/io/printf_core.c

    r5b46ec8 re330da6e  
    14481448                       
    14491449                        switch (uc) {
    1450                         /** @todo Unimplemented qualifiers:
    1451                          *        t ptrdiff_t - ISO C 99
    1452                          */
     1450                        case 't':
     1451                                /* ptrdiff_t */
     1452                                if (sizeof(ptrdiff_t) == sizeof(int32_t))
     1453                                        qualifier = PrintfQualifierInt;
     1454                                else
     1455                                        qualifier = PrintfQualifierLongLong;
    14531456                        case 'h':
    14541457                                /* Char or short */
Note: See TracChangeset for help on using the changeset viewer.